Kay Kay - 1 year ago 401
Javascript Question

Adding UTF-8 BOM to string/Blob

I need to add a UTF-8 byte-order-mark to generated text data on client side. How do I do that?


new Blob(['\xEF\xBB\xBF' + content])
'"my data"'
, of course.

Neither did
work (with
'\x22' == '"'
being the next character in

Is it possible to prepend the UTF-8 BOM in JavaScript to a generated text?

Yes, I really do need the UTF-8 BOM in this case.

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download