encoding/xml: UTF-8 detection is case sensitive

102 views
Skip to first unread message

gchar...@tea-ebook.com

unread,
Aug 31, 2015, 10:59:39 AM8/31/15
to golang-nuts
Hello,

I encountered an issue while parsing some third party XML files, which declare the encoding "Utf-8". This encoding is not recognized by the encoding/xml library.
The fact is that the standard library is looking for either "", "utf-8" or "UTF-8" (here is the code).

Would you say it is a bug? Should not this test be case insensitive (since it already accepts both upper and down case strings)?
Indeed, this XML specification explains that "XML processors should match character encoding names in a case-insensitive way". I understand that "should" does not make this mandatory but would not it be better?

Thanks,

Guillaume.


Ian Lance Taylor

unread,
Aug 31, 2015, 11:30:19 AM8/31/15
to gchar...@tea-ebook.com, golang-nuts
I'm no expert, but it sounds like a bug to me. Please open an issue
at https:/golang.org/issue . Thanks.

Ian

Giulio Iotti

unread,
Aug 31, 2015, 12:00:00 PM8/31/15
to golang-nuts, gchar...@tea-ebook.com
And I probably introduced it :) I'll post another CL.

-- 
Giulio Iotti

gchar...@tea-ebook.com

unread,
Aug 31, 2015, 3:24:06 PM8/31/15
to golang-nuts, gchar...@tea-ebook.com

Thank you for your feedback, Ian and Giulio.
Reply all
Reply to author
Forward
0 new messages