bugGNU gettext - Bugs: bug #52932, XML doesn’t default to UTF-8

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #52932: XML doesn’t default to UTF-8

Submitter:  Piotr Drąg <piotrdrag>
Submitted:  Fri 19 Jan 2018 03:36:25 PM UTC
   
 
Category:  XML Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Tue 01 Oct 2024 07:37:23 PM UTC, comment #3: 


> XML's default encoding, when the file lacks a BOM, or an encoding statement, is UTF-8


https://www.w3.org/TR/xml/#charencoding says more in detail:
"In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), it is a fatal error for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8."

Since GNU gettext does not have a mechanism for communicating "information from an external transport protocol", it is safer to not assume UTF-8.

Bruno Haible <haible>
Group administrator
Tue 23 Jan 2018 09:38:16 AM UTC, comment #2: 

Because XML's default encoding, when the file lacks a BOM, or an encoding statement, is UTF-8, and it's considered a "fatal error" to be in a different encoding than the one specified (explicitly or not).

https://www.w3.org/TR/xml/#charencoding

Bastien Nocera <hadess>
Fri 19 Jan 2018 04:18:37 PM UTC, comment #1: 

Why? Why make an assumption about the encoding (that assumption can be wrong) - thus possibly produce an file in another encoding than the one the caller expects? When we have a way to get away without this assumption and produce a valid and unambiguous XML always.

Bruno Haible <haible>
Group administrator
Fri 19 Jan 2018 03:36:25 PM UTC, original submission:  

If an XML file doesn’t specify encoding (or the XML declaration is missing altogether), then gettext uses an alternative character representation (&#xXXXX;). It should rather just default to UTF-8.

Piotr Drąg <piotrdrag>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by hadess (Posted a comment)
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by piotrdrag (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-10-01 haible StatusNeed Info Not a Bug
        Assigned toNone haible
        Open/ClosedOpen Closed
    2018-01-19 haible StatusNone Need Info

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code