XML technologies / XML / XML in a Nutshell / Internationalization / Platform-specific character sets

(Excerpt from “XML in a Nutshell” by Elliotte Rusty Harold & W. Scott Means)

Besides standard sets, vendors have created proprietary ones for their platforms, often adding special characters such as Apple’s bitten-apple symbol  or box-drawing characters ╒ and ╡ used for early DOS spreadsheet cell borders. Microsoft, IBM and Apple are the most prolific. The most widespread may be Microsoft’s Cp1252, a Latin-1 variant replacing C1 controls with graphic characters. Hundreds now exist, with quality ranging from excellent to dreadful.

Keep such sets within one system, never on networks or between systems: surprises can be ugly. Extra Cp1252 characters <, ‰, ^, ”,†, ..., ‡, œ, Œ, •, ',',“,”,–,—, Ÿ, , ™, > and ˜ could make a VT-220 display unusable. Yet they are common even on the Web. XML does not prohibit them if declared correctly and understood by the parser. Their only advantage is editor familiarity compared with Unicode and related encodings. We strongly advise documented standards with better cross-platform support instead.

Cp1252

Cp1252, probably the most common platform encoding online, is also incorrectly called Windows ANSI. It is the default on most American and Western European Windows PCs, explaining its ubiquity. This single-byte set is almost identical to ISO-8859-1, and files are often mislabeled Latin-1. But C1 positions 128–159 become graphic characters such as ‰, ‡ and Ÿ. Windows handles them, other platforms may misrender or even crash. Avoid Cp1252 and its non-Western Windows relatives.

MacRoman

Mac OS uses another nonstandard, single-byte ASCII superset, MacRoman in America and most of Western Europe. Other countries use MacGreek, MacHebrew, MacIceland and so on. Most XML processors based on Java understand these when labeled correctly, but most non-Macintosh tools do not.

For example, the French sentence »Au cours des dernières années, XML a été adapte dans des domaines aussi diverses que l'aéronautique, le multimédia, la gestion de hôpitaux, les télécommunications, la théologie, la vente au détail et la littérature médiévale« written on a Macintosh and read on a PC becomes »Au cours des derni?res annžes, XML a žtž adapte dans des domaines aussi diverses que l'ažronautique, le multimždia, la gestion de h™pitaux, les tžlžcommunications, la thžologie, la vente au džtail et la littžrature mždižvale«, not quite the same. ASCII leaves much of it readable, but this hardly shows accuracy or quality. Avoid Mac-specific sets too.

  

 

 

 

back to top