Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79376 > unrolled thread
| Started by | random832@fastmail.us |
|---|---|
| First post | 2014-10-21 08:40 -0400 |
| Last post | 2014-10-21 08:40 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: real-life example LC_CTYPE effects? random832@fastmail.us - 2014-10-21 08:40 -0400
| From | random832@fastmail.us |
|---|---|
| Date | 2014-10-21 08:40 -0400 |
| Subject | Re: real-life example LC_CTYPE effects? |
| Message-ID | <mailman.15030.1413895256.18130.python-list@python.org> |
On Mon, Oct 20, 2014, at 16:33, Albert-Jan Roskam wrote:
> Hi,
>
> The locale category LC_CTYPE may affect character classification and case
> conversion.
>
> That's the theory. Can you give a practical example where this locale
> setting matters? Eg.:
> locale.setlocale(locale.LC_CTYPE, loc)
> m = re.match("\d+", s, re.I | re.L)
>
> So with two different values for loc, and s is identical, there will or
> won't be a match.
You're generally isolated from this by using unicode strings - there are
only a few unicode characters that have different case mappings in
different languages. LC_CTYPE was designed in an era of 8-bit character
sets. For example, in a Russian locale with KOI8-R character set, C0-DF
are all lowercase letters, and E0-FF are all the uppercase equivalent,
whereas in an English or other western european locale with ISO-8859-1,
C0-DF [except D7] are all uppercase letters, with the lowercase versions
in E0-FF [except F7], and in a Hebrew ISO-8859-8 locale only E0-FA are
letters and are not uppercase/lowercase.
Try setting the locale to tr_TR and matching "i" against "I", for a
demonstration of one of the few remaining effects this can have.
Back to top | Article view | comp.lang.python
csiph-web