Fix WriteFile with unicode data
authorIustin Pop <iustin@google.com>
Thu, 28 Apr 2011 09:21:19 +0000 (11:21 +0200)
committerIustin Pop <iustin@google.com>
Thu, 28 Apr 2011 10:02:52 +0000 (12:02 +0200)
commit1d39e24501058be4c460084e5380dedbfd5e6a9e
tree3cd006f4eec7892a15a648b366e670263b7ce1e6
parentfd09d178b5324837719ce4d5ce1ab3ed466803b2
Fix WriteFile with unicode data

Unicode is fun, indeed:

>>> len(buffer("abc"))
3
>>> len(buffer(u"abc"))
12

So we can't pass unicode data to buffer(), as the result will be to
write the in-memory (usually UTF-32) representation to disk.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
lib/utils/io.py
test/ganeti.utils.io_unittest.py