Among other uses, these constants are used on HFS+ volumes to choose
which encoding to use when converting Unicode filenames back to an 8-bit
string for old Mac OS APIs.
This is documented in TN 1150 under "Text Encodings".
https://developer.apple.com/library/archive/technotes/tn/tn1150.html
Tests pass on Mac OS X 10.4 PPC.
- Added new source files
- The target is now convert_test instead of syncfiles, because that's
what it is
- Header search paths moved to project settings instead of target
settings
This simplifies the conversion test, since we don't need to be careful
about which data we run the conversion test in. It will also simplify
the command-line conversion tool and its distribution. The classic Mac
OS version of this program will continue to embed conversion tables in
the resource fork.
The main intent is to not allow enums to get condensed to a single line,
but this has the side effect of making clang-format stop attaching
braces to the start of the enum. I felt it made sense to use a different
brace style everywhere rather than live with just enums with braces on a
separate line.
Extract table generation to its own file, table.go, and refactor the
interface. This exposed an inconsistency in the way that line breaks
were handled: both CR and LF on the Mac side were mapped to LF on the
UTF-8 side, but when the conversion table was inverted, the reverse
mappings would conflict. Previously, there was no explicit handling for
it, and whichever Mac charecter had a higher byte value would take
precedence. Conflicts are now detected and return an error, so line
breaks must be mapped explicitly. The new code maps CR, LF, and CRLF to
CR when converting UTF-8 to Mac.
This was previously implemented, but lost. The previous implementation
was probably destroyed when testing this tool.
GitOrigin-RevId: e1a41fc5290e57510c252c8404db86afa1913eba
The previous implementation read the entire file into memory and then
processed it. This version uses reasonably-sized buffers and can handle
files of any size.
Since this new conversion code is a bit more complicated, a test suite
has been added which can be run on ordinary Unix systems.
GitOrigin-RevId: acc7be277103fad1da2d0ca16d1a84be11802fbf