0

Encoding/Decoding working differentlty on different servers. Locally I'm running PHP v5.6. default_charset = UTF-8 according to php_info(). When I pass the value 's in the URL it displays correctly in an input field as 's.

Remotely my Godaddy server is running PHP v5.3, default_charset = No value according to php_info() When I pass the value 's in the URL it displays incorrectly in the input field as %27s.

I have added <meta http-equiv="content-type" content="text/html; charset=utf-8"></meta> in the header of the html file.

Does anyone know how to resolve this so that 's displays as 's on the remote server?

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
user1344131
  • 225
  • 1
  • 4
  • 13
  • that has nothing to do with charsets. it's a proper uri-encoded uri – Marc B Jan 30 '15 at 16:10
  • I should have noted that I get the same results regardless if I pass the 's through htmlspecialchars() or any other encoding or decoding functions. – user1344131 Jan 30 '15 at 16:21
  • htmlspecialchars is pointless. that's for output into an html context. You're not outputting to a browser, you're outputting to a console. you need `mb_convert_encoding()` – Marc B Jan 30 '15 at 16:23

3 Answers3

0

Don't you have to scape the single quote with \' or \'?

Neill Lima
  • 331
  • 3
  • 11
0

' is not a standard alphanumeric character so it gets URL-encoded with a method similar to this one for compatibility.

' is %27 hex or 39 decimal ASCII character.

DeDee
  • 1,972
  • 21
  • 30
0

You need to pass the value through urldecode() before you display value in input field.

Riddhish
  • 373
  • 1
  • 8