Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

[Port]: Pharo 10 - Missing String>>#convertForWithConverter: #9

Open
seandenigris opened this issue Jul 6, 2022 · 1 comment
Open

Comments

@seandenigris
Copy link
Owner

Asked on Pharo Discord:

What is the replacement for String>>#convertForWithConverter:, which has been removed in P10? Soup was using it and I'm not sure how to translate to the new Zn-based encoders. Naively, I tried just restoring the method in P10, but:

aByteString convertFromWithConverter: aZnSimplifiedEncoder "latin1 strict"

led to the error pictured...
Screen_Shot_2022-07-06_at_11 24 34_AM

cc/ @svenvc

@seandenigris
Copy link
Owner Author

Per @svenvc on Discord:

This is old misuse of Strings to store encoded bytes. The replacement would then be something like:

aByteString asByteArray decodeWith: #utf8

Of course, decoding will only work if the source is encoded the way you expect it to be. Plus the ZnCharacterEncoders are normally stricter (but can be relaxed).

Hence, the offending line can be replaced with:

converter decodeBytes: xmlData asByteArray

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant