Why does the "".join(r) do this?

Tim Roberts timr at probo.com
Mon May 24 01:57:44 EDT 2004


moma <moma at example.net> wrote:
>
>What about unichr()  ?
>
>#!/usr/bin/python2.3 -u
>t="abc"+unichr(174)+"def"

That's an easy trap to fall into, but it isn't right.  unichr(174), which
is U+00AE, is the ® (R) registered trademark symbol.  We don't have any
idea whether or not the \xae character in his original 8-bit string was
actually the registered trademark symbol.

The meaning of the original \xae, and therefore the Unicode equivalent of
that character, depends COMPLETELY on the character set of that original
string.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list