Jump to content

Recommended Posts

Hey guys,

 

I'm sorry to come to ask something so vague, but unfortunately I'm being driven insane, and hopefully someone here will actually understand me.  If not... well, no harm trying, I hope.

 

I am trying to make a script to get an image through another sites API.  The problem is, that the ID used to query the site often contains spaces and TM characters and things, and I'm struggling to convert them successfully.

 

For example, to query "Mirror's Edge™" I can search for it properly in FireFox, but for PHP I need to use the query of "Mirror%27s+Edge%99".  However, I can't find how to get this.  I've tried a variety of utf8_encodes (recommended by the API holders) htmlspecialchars, and urlencodes, but the closest I've gotten is "Mirror%27s+Edge%C2%99" by using a nested urlencode within a utf8_encode, and I can't figure where the %C2 is coming from.

 

I'm sorry for vagueness, but since the API holders dont know (!!!) I thought maybe someone here might by chance have encountered similar.

Thanks for any help guys,

Arkane

Link to comment
https://forums.phpfreaks.com/topic/143199-string-conversion/
Share on other sites

urlencode seems to work just fine for me....

 

You're absolutely right.  Thats what I get too.  I've managed to confuse myself somewehere because I spent so much time trying to fix it myself and failing.

 

The string I actually need to convert it to is "Mirror%27s+Edge%E2%84%A2", and I've been nowhere near it... just stupid. :-[

Link to comment
https://forums.phpfreaks.com/topic/143199-string-conversion/#findComment-751242
Share on other sites

<?php
echo urlencode('Mirror\'s Edge™');

 

Translates to "Mirror%27s+Edge%E2%84%A2" for me.... php 5.2.5

Hmm, It think Crayon Violent must be right about charset, but I don't really know anything about it.  I tried duplicating the line, but definitly doesn't translate to that for me, using 2.5.6 on a Windows host.

Although I'm putting money that might have explained it for everyone.

Link to comment
https://forums.phpfreaks.com/topic/143199-string-conversion/#findComment-751449
Share on other sites

Yeah, I'm on a unix host.. I'd be interested in finding out if the translation is platform specific, though I don't feel dedicated enough to boot into windows to find out.

I'll try test on another server if I can... see if I can figure anything out.  Would be interested to know at least.

Link to comment
https://forums.phpfreaks.com/topic/143199-string-conversion/#findComment-751720
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.