Skip to content
Eugene Lazutkin edited this page Oct 3, 2018 · 2 revisions

What if my utf-8 data is decoded incorrectly?

stream-json does not decode utf-8 relying on Node to do it correctly. Apparently in some cases Node can fail to decode multi-byte characters correctly, when they are split between different buffers. If you encounter that problem (I did not see it in the wild yet), you can solve it by piping an input stream through a sanitizer before sending it to stream-json parser. These two packages look promising, and appear to be doing the right thing:

Clone this wiki locally