inexorabletash / text-encoding

Polyfill for the Encoding Living Standard's API
Other
722 stars 267 forks source link

Decode to =?GB18030?B?lDnaMw==?=: failed #49

Closed lygstate closed 8 years ago

lygstate commented 8 years ago

The following GB18030 decode incorrect. =?GB18030?B?lDnaMw==?=:

inexorabletash commented 8 years ago

Can you provide the error as a code sample? I'm not sure how you intend that string to be interpreted. (As a sequence of ASCII bytes? etc)

inexorabletash commented 8 years ago

No feedback, closing.

Artoria2e5 commented 8 years ago

This is an RFC 2047 "encoded-word", written in the "B" (base64) encoding. So it's basically:

new TextDecoder('gb18030').decode(
    Uint8Array.from(
        atob('lDnaMw=='), 
        (ch) => (ch.codePointAt(0))))
// "💩"
inexorabletash commented 8 years ago

Thanks for providing the repro!