Url encoding PHP

后端 未结 2 1522
一整个雨季
一整个雨季 2021-01-23 07:36

Hey guys, I have question about urlencode and rawurlencode...

I tested them out and they produce different result like firefox & some online encoders...

Exam

相关标签:
2条回答
  • They produce different outputs because you provided different inputs, i.e. different character encodings: Firefox uses UTF-8 and your PHP script uses Windows-1252. Although in both character sets the characters are at the same position (ß=0xDF, ä=0xE4), i.e. the have the same code point, they encode that code point differently:

     CP   | UTF-8  | Windows-1252
    ------+--------+--------------
     0xDF | 0xC39F |         0xDF
     0xE4 | 0xC3A4 |         0xE4
    

    Use the same character encoding (preferably UTF-8) and you’ll get the same result.

    0 讨论(0)
  • 2021-01-23 08:09

    maybe base64 encode, and use in post, to not make visitors afraid of this URL's? Arsen

    0 讨论(0)
提交回复
热议问题