Re: multi-byte awareness for formatted_print.c

From: Date: Wed, 10 Oct 2001 13:04:21 +0000
Subject: Re: multi-byte awareness for formatted_print.c
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-67685@lists.php.net to get a copy of this message
On 09/10/01, "Stig Sæther Bakken" <ssb@alltheweb.com> wrote: > > A possible solution might be to code a generic multibyte string walking > > function in the mb_string extension that, given a point to a multi-byte > > string, returns the wide character at the current position and advances the > > pointer to the next wide-character > What about using a typedef or #define to define a "phpchar" type that > is used in all such functions instead of "char"? Or would it be too > inflexible to determine this at compile time? If only it was that simple; the problem is all the code that does str++ to advance through the string, so to make everything multi-byte safe, everything needs to change from str++ syntax to a multi-byte character advancing function/macro. Once it is all changed, it is then a simple matter to conditionally build a multi-byte aware PHP. Windows already does this if you #include <tchar.h>, use TCHAR instead of char and #define a constant you end up with compile time control to produce either single-byte, multi-byte or (IIRC!) unicode. The story on unix depends on your platform. I know that some libcs have wide char types and API, but I don't know if we have an equivalent of tchar.h. Does anyone else out there know about this? If we can't rely on the platform, the mbstring extension has a bunch of functions that are useful for this. --Wez.

« previous php.dev (#67685) next »