Arkane Posted March 15, 2009 Share Posted March 15, 2009 Hey guys, I'm having some problems trying to convert stuff to access an external api. The site I'm using has access by querying with a title formatted as UTF-8, however I can't seem to get the right results in php. I have been messing around all day, and have made no progress basically. What I have so far, is urlencode(utf8_encode($game)) This half works, but not fully What I'm trying to get it this Game = The Incredible Hulk™, Actual Result = The+Incredible+Hulk%99, Desired Result = The+Incredible+Hulk%E2%84%A2 Game = Unreal Tournament® 3, Actual Result = Unreal+Tournament%C2%AE+3, Desired Result = Unreal+Tournament%C2%AE+3 Game = LEGO® Indiana Jones™, Actual Result = LEGO%C2%AE+Indiana+Jones%C2%99, Desired Result = LEGO%C2%AE+Indiana+Jones%E2%84%A2 As you can see, it works for some symbols, but not others. I've been searching, and according to the letter database, the desired does match up for what the UTF-8 codes should be, I'm just not getting them. I'm pulling the game names out of a mysql database, but I have also tried it as a constant, and still have the same problem. Can anyone give any suggestions asto why this is happening, or what might make it go right? Cheers Arkane Link to comment https://forums.phpfreaks.com/topic/149487-utf-8-urls/ Share on other sites More sharing options...
corbin Posted March 15, 2009 Share Posted March 15, 2009 %E2%84%A2 = â„¢ in ASCII, which is most likely how the URL is being translated. Just wondering.... Why is UTF8 needed in those 3 examples? None of those characters can't be represented in ASCII. (Or am I remembering incorrectly?) Link to comment https://forums.phpfreaks.com/topic/149487-utf-8-urls/#findComment-785035 Share on other sites More sharing options...
Arkane Posted March 15, 2009 Author Share Posted March 15, 2009 Just wondering.... Why is UTF8 needed in those 3 examples? None of those characters can't be represented in ASCII. (Or am I remembering incorrectly?) Its because of the API I'm trying to access. They have the names encoded that way as a parameter. I've tested the urls, and the desired ones do work, whereas the others give "no info found". Link to comment https://forums.phpfreaks.com/topic/149487-utf-8-urls/#findComment-785195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.