Skip to content

Instantly share code, notes, and snippets.

Marcello di Simone MarcelloDiSimone

Block or report user

Report or block MarcelloDiSimone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MarcelloDiSimone
MarcelloDiSimone / utf8-regex.js
Last active Jul 5, 2018 — forked from chrisveness/utf8-regex.js
Utf8 string encode/decode using regular expressions
View utf8-regex.js
/**
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters
* (BMP / basic multilingual plane only).
*
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars.
*
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)),
* but this approach may be useful in other languages.
*
* @param {string} strUni Unicode string to be encoded as UTF-8.
You can’t perform that action at this time.