Re: [PHP-I18N] ctype_print returns false for British Pound symbol (and non-ASCII symbols)

[email protected] (Norbert Lindenberg ♻) Fri, 26 Feb 2010 10:54:20 -0800
Newsgroups php.i18n
Message-ID <[email protected]>
In which character encoding is your '=C2=A3' represented? Remember that =
PHP =20
is ignorant about character encodings, a string is just a sequence of =20=

bytes, and it's up to the application developer to make all components =20=

agree on the character encoding used. If your '=C2=A3' happens to be =20
encoded in ISO 8859-1, then its byte representation is the same as =20
"\xA3", which is not a valid UTF-8 string.

Norbert


On Feb 26, 2010, at 08:21 , Bob wrote:

> [I did post this to php.general, but I think php.i18n may be more
> suitable.]
>
> In summary: ctype_print returns false for a string containing the =20
> British
> Pound symbol, and I'm sure that's not how it should behave.
>
> So far as I can tell, the British Pound symbol, '=C2=A3' is considered =
a
> printable character according to the locale I use on my Ubuntu box. =20=

> But
> even across two years, two boxes, several versions of Ubuntu (from =20
> 7.04
> to 9.10, one x86, one AMD64), and two major versions of PHP (PHP 4 and
> now PHP 5.2.11), I cannot get ctype_print to return true when a string
> given to it contains the British Pound symbol. (Or other non-ASCII
> characters such as =C3=B8 or =C3=9F.)
>
> The locale I'm using is en_GB.UTF-8 and when I call setlocale(LC_ALL,
> 'en_GB.UTF-8') in PHP, it returns the name of this locale rather than
> FALSE, so that seems to be in order. (However, to be sure I have
> installed and reinstalled the language pack in Ubuntu as suggested by
> others.)
>
> I've even read through the en_GB and i18n locale definition files to
> confirm that <U00A3> (for the British Pound symbol) does appear within
> the print and graph sections, so both ctype_print and ctype_graph =20
> should
> consider it acceptable.
>
> What's most maddening is that ctype_print does return true on my =20
> shared
> hosting server, so I know that it can be achieved. I'm just hoping =20
> that
> someone here can tell me what I'm doing wrong, or what my operating
> system is doing wrong.
>
> For your information, I'm currently running the following:
>
> Ubuntu 9.10 (AMD64)
> Apache 2.2.14
> PHP 5.2.11 running as a CGI (to mirror the config of my shared host)
> Locale in use: en_GB.UTF-8
> LANG=3Den_GB.UTF-8
>
> Can anyone tell me how to get ctype_print to behave?
>
> --=20
> PHP Unicode & I18N Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>