Repository navigation
Conversation
OSTA CS0 with compression ID 8 stores one byte per character, and those bytes are the Unicode code points U+0000..U+00FF, i.e. Latin-1. udf_decode_cs0() and udf_decode_dstring() copied them verbatim into node names and the volume name, so a non-ASCII name produced invalid UTF-8 even though odfs_node_t names are UTF-8 and the 16-bit CS0 path already converts to UTF-8. Encode bytes >= 0x80 as two-byte UTF-8 sequences, and let udf_decode_dstring() reuse udf_decode_cs0() instead of carrying its own copy of the decoder. This is a user-visible change on AmigaOS: the Amiga frontend copies node names into the FileInfoBlock and ExAllData unconverted, and the system charset there is Latin-1. 8-bit UDF names, which display correctly today, would then show as "Müller" instead of "Müller", the same way Joliet, HFS and 16-bit CS0 names already appear. Host tools that expect UTF-8 get valid names.
Owner
Author
|
Folded into #56: the same commit is there, after the handler learned to convert names to Latin-1, so 8-bit UDF names keep displaying correctly on AmigaOS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
udf: decode 8-bit CS0 names as Latin-1 to UTF-8
This commit was split out of #43. It is correct for the backend contract, but on its own it makes names on AmigaOS worse, so it is a draft.
What it does
OSTA CS0 compression ID 8 stores Latin-1 bytes. The UDF backend copies them into node names verbatim, so every other path gives UTF-8 and this one gives raw Latin-1. The commit encodes bytes ≥ 0x80 as two-byte UTF-8 and lets
udf_decode_dstring()shareudf_decode_cs0(). It adds a unit test,udf_cs0_8bit_name_decodes_latin1_to_utf8, which fails on main.Size: 68000 −100 bytes, 68020 −128 bytes, ROM unchanged (no UDF).
Why not merge it alone
node.nameintofib_FileNameanded_Nameunconverted (fill_fiband the ExAll fill inplatform/amiga/handler_main.c). There is no UTF-8 to Latin-1 step anywhere in the handler, and the system charset on OS3 and OS4 is Latin-1.What would fix it
Add the conversion in the Amiga frontend rather than the backends:
?. Byte sequences that are not valid UTF-8, for example raw Latin-1 Rock Ridge names, pass through unchanged.With that in place, this commit becomes required: otherwise 8-bit UDF names would be raw Latin-1 bytes going into a UTF-8 decoder. It should land in the same series as the frontend change.
The cost is a conversion on every directory entry and on every path component looked up. That has to be checked against CDBench (ExAll and lock latency) before it can go in.