RE: [PHP-I18N] Chinese (BIG5/GB) characters

From: Date: Wed, 23 Aug 2000 02:25:42 +0000
Subject: RE: [PHP-I18N] Chinese (BIG5/GB) characters
Groups: php.i18n 
Request: Send a blank email to php-i18n+get-60@lists.php.net to get a copy of this message
Hi Hiro, > Following answer is based on using PHP with Japanese. Since both > Japanese and Chinese are multi-byte encoded, my guess shouldn't be > far off. Thanks for the reply, either way :) > >As a Newbie(tm) here, please go easy if I've gotten a few > >things wrong. > > 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 :) > 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) > 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? > Problem with manipulation of data will depend on what you do with that > text data. If you do any regex, most likely it will fail since PHP's > regex is not designed to work with multibyte encoding such as big5 or > gb. If you are simply doing something like: > > <?php print $text1 . "/" . $text2; ?> > > It should work. But something like: > > <?php print ereg_replace("^[[:alpha:]]", "", $text2); ?> > > It may work, or it may not. Since both gb and big5 can contain 7bit > range byte for the second byte of a charactor, regex like above will > not work the way you expect. I won't be manipulating the string, it should be passed on unaltered. Is it possible to check the string length? > Does this answer your question? Yes, I think it does... I'm sure I'll have more, so thanks :) Jason

« previous php.i18n (#60) next »