Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.