Decoding/Encoding Href Links
Question: How can I get the result of `expected` to return a readable string? In other
words, when given `/wiki/Cookbook:Cao_l%E1%BA%A7u`, it should return
`/wiki/Cookbook:Cao_lầu`.

**Note** : I'm running on Python 2.7.2

    
    
    import urllib
    
    test_array = [
        '/wiki/Cookbook:Bulgarian_Meatball_Soup_(Supa_Topcheta)',
        '/wiki/Cookbook:Campfire_S%27mores',
        '/wiki/Cookbook:Candied_Almonds_(Br%C3%A4nda_mandlar)',
        '/wiki/Cookbook:Chicken_%26_Pasta_Alfredo',   
        '/wiki/Cookbook:Cozido_%C3%A0_Portuguesa'
    ]
    
    actual = [urllib.unquote(i).decode('utf-8') for i in test_array]
    
    assert '/wiki/Cookbook:Bulgarian_Meatball_Soup_(Supa_Topcheta)' == actual[0]
    assert "/wiki/Cookbook:Campfire_S'mores" == expected[1]
    assert '/wiki/Cookbook:Candied_Almonds_(Brända_mandlar)' == actual[2]
    assert '/wiki/Cookbook:Chicken_&_Pasta_Alfredo' == actual[3]
    assert '/wiki/Cookbook:Cozido_à_Portuguesa' == actual[4]
    


Answer: You need to specified the unicode literals (prefixing `u`) instead of string
literals, because the
[`str.decode`](https://docs.python.org/2/library/stdtypes.html#str.decode)
returns `unicode` object.

    
    
    assert u'/wiki/Cookbook:Bulgarian_Meatball_Soup_(Supa_Topcheta)' == expected[0]
    assert u"/wiki/Cookbook:Campfire_S'mores" == expected[1]
    assert u'/wiki/Cookbook:Candied_Almonds_(Brända_mandlar)' == expected[2]
    assert u'/wiki/Cookbook:Chicken_&_Pasta_Alfredo' == expected[3]
    assert u'/wiki/Cookbook:Cozido_à_Portuguesa' == expected[4]
    

BTW, I would give `expected` a different name like `actual` or `got`. (String
literals are expected outcome, right?)

