Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

Thread Tools Display Modes
Share |
Old 07-27-2010, 03:27 PM
marc_gfx marc_gfx is offline
Contributing Member
Join Date: 07-01-06
Posts: 126
iTrader: 0 / 0%
PHP/AJAX character encoding

I'm trying to transmit binary data via AJAX. The binary data is stored in a normal string, so it's not really binary anymore, but it results in the string containing weird characters.

I save the transmitted data in PHP to a file, that I later want to be able to load again via AJAX.

//string in Javascript

to transmit I use escape(txt)

//what gets stored in the file
something that looks chinese, only very few characters compared to the original, so it looks like one character uses multiple bytes

//result (both loaded from file, or echoed in the receiving file of ajax request)

any idea what I could be doing wrong? to me it looks like an encoding issue.

The binary data is fine by the way, I just can't get the same string back that I originally sent. I've set headers in both php and html to utf-8, i've set php's mbstring to utf-8, can't think of much else right now.
Reply With Quote



Old 07-27-2010, 04:09 PM
marc_gfx marc_gfx is offline
Contributing Member
Join Date: 07-01-06
Posts: 126
iTrader: 0 / 0%
yay... found a solution. I had to utf8_encode the string. seems pointless as I've already set everything I could to utf8, but it works...
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Encoding PHP DigitalAlien Coding Forum 0 05-18-2010 06:54 PM
Help make set minimum character for OSCommerce search, example set for 4 character basketmen Coding Forum 3 10-22-2009 02:41 AM
Turn normal Character into chinese character skyscraper Forum Lobby 3 04-29-2008 01:29 PM
AJAX: bots hitting AJAX scripts kkiely Coding Forum 1 04-21-2007 01:14 AM
Choosing a char-set (character encoding) cyberdread Web Design Lobby 1 05-12-2005 07:02 AM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 08:15 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC