Skip to main content

Module macroman

Module macroman 

Source
Expand description

Mac OS Roman, for classic Mac OS resource text.

This module is a short front for Encoding::Roman. Persons who work with resources use this encoding much more than the other 20 encodings. The module operates on resource type codes and on string resources. For all other work, use Encoding.

§The source of the mapping

The mapping is Apple’s ROMAN.TXT. It agrees fully with index-macintosh.txt in the standard, which gives the macintosh encoding. The tests in tests/whatwg_conformance.rs compare the two.

§Two bytes that need an explanation

Byte 0xDB is U+20AC. Before Mac OS 8.5, it was ¤ U+00A4. Apple Technote TN1140 gives this change. Apple’s table and the standard both have the new value. Thus this crate has it also. Text from before Mac OS 8.5 with a currency sign decodes to a euro sign. The bytes alone do not show you which of the two characters the text had.

Byte 0xF0 is the Apple logo. Unicode has no character for it. The mapping uses U+F8FF, which is a private use character. Thus it has a meaning only for programs that use Apple’s rule. The mapping file CORPCHAR.TXT is the register of these characters.

§A different mapping with the same name

RFC 1345 gives a different mapping. The IANA macintosh registration (MIBenum 2027) refers to RFC 1345. Both show The Unicode Standard 1.0 of 1991, which is earlier than the two changes above. That mapping has ¤ at byte 0xDB. It also has no character for bytes 0xF0, 0xF6, and 0xF7. Text that you decode with those tables is different.

Functions§

decode
Decodes Mac OS Roman bytes.
encode
Encodes text to Mac OS Roman. The first character with no byte gives an error.