Closed adrientetar closed 8 years ago
3rd time's a charm.
:+1:
sorry again. I don't know compositor's code much, but.. wouldn't it be better if it always uses unicode strings on both python 2 and 3 (i.e. toUnicode
instead of version-specific toStr
).
Well, I thought these strings are to be consumed by the user and as such should be in each version's preferred form. But what the current code is doing, it looks like it's assuming utf16-be and unpadding it. So that would be unicode.
I'll change to use toUnicode() then.
FWIW, that name extraction is very old and probably very rarely used. The idea was to get basic, RoboFab-like naming info from the binary for reference. I wrote the code and I don't recall ever even using it myself.
Oh, but the stylistic set naming info is used by defconAppKit's GSUB/GPOS controls.
so the question would be, can the client handle unicode strings or is expecting bytes, and if so, with which encoding? The first option should be preferable (using unicode wherever possible).
Unicode strings.
ok. so the current patch should work.
@typesupply I haven't tested
_nameToString
on Python 2, maybe best to test it before merging. Anyhow, it should be more robust than the current decoding code.