Re: Chinese (BIG5/GB) characters

From: Date: Thu, 24 Aug 2000 06:54:24 +0000
Subject: Re: Chinese (BIG5/GB) characters
References: 1 2  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-64@lists.php.net to get a copy of this message
Hiro, The problem that I found is that servers like Apache may write out the header before invoking the PHP script. The header contains the charset that PHP must use the send data to the browser. My ICU Apache mods look for a locale name in the URL to determine locale. From locale I pick the charset in the my extensions to the mime processing. Thus all of your scripts in a directory use the same codepage and will send in the same codepage. All of its subdirectories unless they are a specific locale name use the same code page. Carl "Hironori Neal Sato" <satoh@yyplanet.com> wrote in message news:20000822205758.A25420@satoh.rc.yyplanet.com... > 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/ > > -- > PHP Internationalization Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-i18n-unsubscribe@lists.php.net > For additional commands, e-mail: php-i18n-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.i18n (#64) next »