Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:29:56+00:00 2026-06-03T10:29:56+00:00

I’m working on an application where I need to be able to send a

  • 0

I’m working on an application where I need to be able to send a string from JavaScript to PHP. At first I had just sent it through $_POST variable, but I noticed that it was inserting values into the string.

Then I recoded both parts to use base 64 to send the data because I assumed that the data was being mangled in transmission. The string was being transferred just fine with no mistakes, but then when I converted it back from base 64 to base 16, it had the exact same mistakes as before!

Here is a comparison of the two strings (hex dumps). There are two meaningful chunks of data in each string, and it seems PHP is making mistakes only near those areas. The first line is how PHP is interpreting the string, and the second line is how I’m sending it from JavaScript.

c2 b0 c2 a7 c3 9a 7a 00 00 00 c2 bb 30 4d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0 a7 da 7a 00 00 00 00 00 00 bb 30 4d 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Why are these phantom bytes appearing?

EDIT: Here’s the code I’m using.

JavaScript:

function sendRequest(body)
{
    var url = "../update/index.php";
    $.post(url,{msg:body},function(data,status,jqx)
    {
        $("#response").html(data);
    });
}

body is a string whose beginning is hard-coded as "\u00b0\u00a7\u00da\u007a".

Then in PHP:

$msg =$_POST['msg'];
plain_hex_dump($msg);

plain_hex_dump simply outputs the string as hex, resulting in the first of the two hex dumps above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:29:57+00:00Added an answer on June 3, 2026 at 10:29 am

    This is UTF-8 encoding.

    b0 is encoded as c2 b0. a7 becomes c2 a7. da becomes c3 9a. 7a is not changed.

    Thus your b0 a7 da 7a is represented in UTF-8 as c2 b0 c2 a7 c3 9a 7a.

    It appears that Javascript is UTF-8-encoding your body variable. You could try using the utf8_decode function in PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Does anyone know how can I replace this 2 symbol below from the string
Thanks in advance for your help. I have a need within an application to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.