Author Topic: $_POST or $_GET variable having multi language support  (Read 1153 times)

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
$_POST or $_GET variable having multi language support
« on: October 02, 2009, 01:15:44 AM »
hi all,

 I am having some problems while posting a form containing other lingual characters or sending them using get method
 they are not being sent exactly.

here other lingual mean non-english. (it would be better if it's some chineese or japaneese which are not similiar to english)

i use ini_set ('default_charset', 'utf-8');
and mysql_query("set names 'utf8' collate 'utf8_general_ci'");

while a guy is filling the form in his own language , there is no poblem.
but when he submits the data, the problem arrives. it's changing the data into some rubbish and then posting it (or sending through get).

i tried google but in vain.
can anybody here show me the light ?
 
bbgFramework v0.1.3
Sun Database Class v0.3

Offline travo

  • Level 18
  • *
  • Posts: 186
  • Reputation: +2/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #1 on: October 02, 2009, 02:31:56 AM »
Is it possible that the page is not set to utf8, and is then sending off the data as something else?

I havent got multiplelanguages yet, but that is all I can think of.


Why are you updating their name through get, if you dont mind me asking?

Offline Delifisek

  • Level 12
  • *
  • Posts: 79
  • Reputation: +1/-1
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #2 on: October 02, 2009, 03:22:10 AM »
One of your file was not utf encoded.

Your php file, library file even, html template.

Check all of your project files and make sure they had proper utf8 encoding.

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #3 on: October 02, 2009, 03:52:46 AM »
i said that the page has headers as i mentioned in my first post.

i am sending name trough get cuz i use ajax to register a user.
bbgFramework v0.1.3
Sun Database Class v0.3

Offline travo

  • Level 18
  • *
  • Posts: 186
  • Reputation: +2/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #4 on: October 02, 2009, 04:03:04 AM »
Is there a reason why you cannot use post in your ajax request?

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #5 on: October 02, 2009, 05:39:43 AM »
no
no reason
but it's the same result with post too
bbgFramework v0.1.3
Sun Database Class v0.3

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #6 on: October 02, 2009, 06:08:42 AM »
If you are using multibyte characters (like Chineese or Japaneese) you should reread PHP docs. Many things works different then, you need to use special functions (like string comparison).

Offline Nox

  • Level 35
  • **
  • Posts: 767
  • Reputation: +12/-2
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #7 on: October 02, 2009, 07:00:23 AM »
You can also try changing http://cz2.php.net/manual/en/mbstring.overload.php option... I didn't test it, but doesn't sound bad
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline travo

  • Level 18
  • *
  • Posts: 186
  • Reputation: +2/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #8 on: October 02, 2009, 07:08:24 AM »
Sorry I thought I read that it was only when using get. My mistake.


Have you tried the settingshere? Mabe PHP is automatically converting the input.

Have you set the content type for the requst?

Can you use something to check all requests?eg firebug. see if the outgoing request is what you typed in, in the right encoding, etc.

Just a thought, how do you know that they are not being sent correctly? Because even if you store a utf-8 character in a non-utf charset, it should still display right if your output page is set to utf-8 shouldnt it?

Im sure this was the case when I made a WoW spider for someone a few years ago... So is your output wrong, or are you viewing through pma? Because pma will display it incorrectly.


Sorry, Im just saying any possible causes that pop into my head... Hopefully one will be it :)
« Last Edit: October 02, 2009, 07:15:09 AM by travo »

Offline Scion

  • Level 27
  • **
  • Posts: 402
  • Reputation: +11/-0
    • View Profile
Re: $_POST or $_GET variable having multi language support
« Reply #9 on: October 02, 2009, 08:08:16 AM »
If i recal correctly the specifications for url encoding are not clear on this...(i seem to recall reading that anyway) and then because the encoding isnt clear the server does not know how to decode the url correctly so what aou get is a string thats incorrect but if you convert the binary back to the correct format the values are then available correctly (well that what we had to do with utf -8 encoded submission being decoded as ISO...

I also had a similar problem a year or two back (albeit in a java environment) the cause was that there were some hidden (you couldnt see them in the editor) special chars at the start of the file that were overriding the expected behaviour...these were inserted when shifting the source from a linux machine to a widows machine

So there are a couple of starting places.

It still amazes me that the specification is so lax (or more specifically still so lax) when it comes to internationalisation.....


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal