Benjamin Crouzier
Benjamin Crouzier

Reputation: 41905

What is the encoding method used in this string?

I am reading a documentation, but it is not specified how to encode url's. Normally, you use urlencode, but i don't think it is the case here. What is the encoding method used in this string :

http://url.retour.com/err.cgi?order_ref=votreRF12345

Edit: What php method(s) sould i invoke on this string http://url.retour.com/err.cgi?order_ref=votreRF12345 in order to encode it ?

Upvotes: 3

Views: 9294

Answers (4)

Benjamin Crouzier
Benjamin Crouzier

Reputation: 41905

This string can be decoded with html_entity_decode, like this:

<?php
echo html_entity_decode('http&#x3a;&#x2f;&#x2f;url.retour.com/err.cgi&#x3f;order_ref&#x3d;votreRF12345');"
// output: http://url.retour.com/err.cgi?order_ref=votreRF12345

Upvotes: 4

Andrew
Andrew

Reputation: 1203

These are HTML entities. Decode them with html_entity_decode (ref)

In response to your edit: encode with htmlentities (ref)

Upvotes: 0

SergeS
SergeS

Reputation: 11779

XML Entities - x3f means char 03F UTF which is ?

Upvotes: 0

Boldewyn
Boldewyn

Reputation: 82734

It's HTML/XML encoding. The structure is &#, then x and the hex value of the Unicode codepoint (in this case identical to ASCII) and a closing ;.

Upvotes: 3

Related Questions