Re: Chinese (BIG5/GB) characters

From: Date: Wed, 23 Aug 2000 03:57:58 +0000
Subject: Re: Chinese (BIG5/GB) characters
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-62@lists.php.net to get a copy of this message
On Wed, Aug 23, 2000 at 12:25:42PM +1000, Jason Murray wrote: >> What have you gotten wrong? > >I'm not sure yet - I'm trying to make sure PHP can handle what I need >to do before I start the project. I don't want to discover in a couple >of weeks' time that I can't do it :) Well, don't take my words or anybody else's. If you are going to start a project, and not sure if it works or not... well, try it on your own first! >> Are you saving that data by any chance (database, file, etc)? > >The data will be passed on to a database elsewhere via HTTP POST (I'll >most likely be using cURL for this, http://curl.haxx.se) hmmm, interesting. Since you are expecting data to be in either big5 or gb, why not save the data once. Then, use external program to convert it to particular encoding (pick one). After conversion, you can pass that data somewhere else. >> If you just receive input data and echo/print on the next page, it >> shouldn't be a problem. > >Is there a way to tell whether I'm receiving BIG5 or GB characters in >this string? Do I need to alter the ENCTYPE attribute of the <FORM> tag? Currently, there are no way of detecting encodings within PHP. This is why we, php i18n team in Japan, implemented auto detection of encoding in php3. No, we haven't done this with php4 yet. You can do everything to make clients give you the data in given encoding, but some will blatantly ignore you. In another words, you can create a form html in big5 and expect to have the browser return in big5, but in reality, it doesn't work 100% of the time. Some funky browser will send you back UTF-8 or some other encodings!! IIRC, only enctypes you can have with form are either aplication/x-www-form-urlencoded or multipart/form-data. This does not set what encoding the data should be in. This enctypes' 'encoding' and text 'encoding' are two totally different thing. >I won't be manipulating the string, it should be passed on unaltered. That will make things bit easier. >Is it possible to check the string length? You want to know how many bytes? Shouldn't be a problem. You want to know how many characters? You need to write your own strlen() for Chinese encodings. >> Does this answer your question? > >Yes, I think it does... I'm sure I'll have more, so thanks :) Good luck. My recommendation is to try it first. That's the only way you can find out! When you face a problem, I'm sure someone on this list will give ya an answer. Hiro -- Hironori Neal Sato <satoh@yyplanet.com> YYplanet.com - http://www.yyplanet.com/

« previous php.i18n (#62) next »