Hi,
When I specify author name using wide characters, such as '作者', and do
not set author initials explicitly, xmllint will complain with
following error:
a2x: executing: xmllint --nonet --noout --valid /home/dram/test.xml
/home/dram/test.xml:12: parser error : Input is not proper UTF-8,
indicate encoding !
Bytes: 0xE4 0x3C 0x2F 0x61
<authorinitials>▒</authorinitials>
^
I think the error is caused by the code generating author initials. We
should decode string to unicode before doing slice and than encode it
back.
Following patch may fix it.
--- /usr/bin/asciidoc.py 2010-12-10 20:52:07.000000000 +0800
+++ asciidoc.py 2010-12-11 10:53:36.869094991 +0800
@@ -1568,8 +1568,9 @@
author = author.strip()
author = re.sub(r'\s+',' ', author)
if not initials:
- initials = firstname[:1] + middlename[:1] + lastname[:1]
- initials = initials.upper()
+ initials = (char_decode(firstname)[:1]
+ + char_decode(middlename)[:1] +
char_decode(lastname)[:1])
+ initials = char_encode(initials).upper()
names = [firstname,middlename,lastname,author,initials]
for i,v in enumerate(names):
v = config.subs_specialchars(v)
Thanks,
Xin Wang
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/asciidoc?hl=en.