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.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-27-2010, 03:27 PM
Contributing Member
Latest Blog:
None

 
Join Date: 07-01-06
Posts: 126
iTrader: 0 / 0%
marc_gfx is liked by many
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
È'marcgfx"ÏÿP…:e5ÿÿÿPesce

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)
�'marcgfx"��P�:e5���Pesce

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.
__________________
Test your geography knowledge on MapBattle.com! You can also make your own map challenges ;)

Get your real-life teams organized! Onlito.com, Online Team Organisation (Free & Beta)
Share |
Reply With Quote
  #2 (permalink)  
Old 07-27-2010, 04:09 PM
Contributing Member
Latest Blog:
None

 
Join Date: 07-01-06
Posts: 126
iTrader: 0 / 0%
marc_gfx is liked by many
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...
__________________
Test your geography knowledge on MapBattle.com! You can also make your own map challenges ;)

Get your real-life teams organized! Onlito.com, Online Team Organisation (Free & Beta)
Share |
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Encoding PHP CyberWizard 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


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:52 AM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.