On Fri, 2006-12-01 at 17:26 +0100, Hans Meine wrote:
> But Duncan asked for Unicode strings, how can those be latin8 or utf-8?
Well, there's an ambiguity there: unicode strings, or unicode objects?
If he was asking about the internal representation of unicode objects,
your answer is thorough.
Informally we tend to think of a unicode string as a sequence of bytes
in some encoding, even if that's not technically correct. So in this
sense a "unicode string" is ambiguous as it could mean any encoding.
(Of course my implication that a latin-1 encoded string is a unicode
string isn't right, but it's convenient to think of latin-1 as a unicode
encoding, especially in python where it basically is treated that way.)
Notice that ...
> function: u"Hans".encode("utf-8") will make it an 8 bit unicode string again,
... you also referred to an encoded utf8 sequence as a "unicode string."
So when Duncan asked about the character size of a unicode string, I
interpreted it as the character size of some encoded string, rather than
the internal representation of unicode objects. Turns out that's what
he actually meant, too.
> ..I find this misleading, since with a properly setup system, you *should*
> know which encoding the filename has. I am used to Qt, which has
Well, I find this misleading too. What is a properly setup system? I
assume a stock Fedora Core 5 system is properly setup. Yet when I
download some mp3s from a friend of mine in Europe whose filenames are
encoded as latin1, now I have latin1 filenames on my filesystem whose
encoding is set to utf8.
Maybe this suddenly becomes an improperly configured system, but it is,
I would think, not that obscure a use-case.
> I wonder if there should be an additional filename_to_unicode function which
> uses sys.getfilesystemencoding() instead of strutils.ENCODING?
This makes good sense. I agree we should have a function like this in
strutils.
Cheers,
Jason.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel