ASCIIPropertyListParser: handle non-7b-ASCII chars#47
Closed
matvore wants to merge 1 commit into
Closed
Conversation
Currently, ASCIIPropertyListParser takes bytes[] and then pads the bytes with an extra 00 byte to get UTF-16. If the byte is >= 0x80, then it pads it with 0xff. This means that if the bytes are in the 7-bit ASCII range, everything is fine. But if not, 0x80 for example becomes 0xff80, (half-width TA katakana) which I don't believe corresponds to any real encoding system. The options are to: - convert using the default system encoding - convert using UTF-8 I think UTF-8 is a better default. The default system encoding is good for backwards compatibility, but this feature (non-7-bit ASCII) has never worked at all before, so that's not really necessary. This can also be made configurable if the need presents itself.
Owner
|
I didn't know char casting did that, that was not intended behavior. So I redesigned the approach for parsing ASCII property list. It now works on a char array instead of a byte array. An encoding can be specified explicitly, otherwise the parser attempts to detect it (UTF-8, UTF-16, UTF-32 or ASCII). I created a feature branch for this reworked parser: https://github.com/3breadt/dd-plist/tree/asciipropertylist-configurable-encoding What do you think? |
Contributor
Author
|
That's great! That commit would definitely fit my requirements. |
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.
Currently, ASCIIPropertyListParser takes bytes[] and then pads the bytes
with an extra 00 byte to get UTF-16. If the byte is >= 0x80, then it
pads it with 0xff. This means that if the bytes are in the 7-bit ASCII
range, everything is fine. But if not, 0x80 for example becomes 0xff80,
(half-width TA katakana) which I don't believe corresponds to any real
encoding system.
The options are to:
I think UTF-8 is a better default. The default system encoding is
good for backwards compatibility, but this feature (non-7-bit ASCII)
has never worked at all before, so that's not really necessary. This can
also be made configurable if the need presents itself.