0

I have a https request using ajax to external php page like in the code bweloow. Please note there are some strange non UTF-8 chars that have to be encoded, otherwise i would get a strange return.

//ajax request to external site
sometext = "I only wear Rtrtrr® shoes, and my name is Åron"; 

sometext = some_encoding(sometext); //a PSEUDO code line

$.ajax({
    type: "POST",
    url: "http://targetsite.com/process_text.php",
    data: sometext,
    cache: false,
    success: function(proc_text) {
        alert()
    }
 });    

On php page, then, I need to decode and use some_decoding(sometext) instead of some_encoding(sometext).

Is there any way to encode such text, with some_encoding function i javascript that has analog function for some decoding in php.

For example encodeURIComponent doesn't convert all the chars, while Base64 I used is not the same in PHP and Javascript in some cases. Is there something that is the same.

Brana
  • 1,197
  • 3
  • 17
  • 38

0 Answers0