タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

javascriptとunicodeに関するnilabのブックマーク (3)

  • [JavaScript] サロゲート・ペアに対応した文字列操作関数を書いてみた / LiosK-free Blog

    2008-11-06 カテゴリ: Client Side タグ: JavaScript 安易な発想 Unicode JavaScriptの文字列型はUTF-16を採用しているから、サロゲートペアを使用した文字が混ざるといろいろと厄介だったりする。一例としては↓のような感じ。 var s = "𪚲"; // U+2A6B2 console.log(s.length); // 2 console.log(s.split("")); // ["�", "�"] ということで、サロゲートペアの扱いを少し楽にする関数を書いてみたからとりあえず公開してみる。 /** 文字列中にサロゲートペアを含む場合はtrue */ String.prototype.hasSurrogate = function() { return (/[\uD800-\uDBFF][\uDC00-\uDFFF]/).test(

    nilab
    nilab 2015/03/05
    _[JavaScript] サロゲート・ペアに対応した文字列操作関数を書いてみた / LiosK-free Blog : 「JavaScriptの文字列型はUTF-16を採用」「String.prototype.hasSurrogate = function() {return (/[\uD800-\uDBFF][\uDC00-\uDFFF]/).test(this);};」
  • Node.js : UTF8の4バイト文字は無理矢理クライアント処理する : typeOf 'aki_mana'

    UTF-8の4バイト文字は、Unicodeの拡張領域。 で、この領域の文字はNodeでは未対応なのだけど、クライアント側で「数値参照」に加工しちゃえば、何とかなるんじゃないか?と思った。 「JavaScript コードポイント」でググれば見つかるこのエントリ内のコードと組み合わせる。 // toNumericCharacterReference for SMP(Supplementary Multilingual Plane) String.prototype.toNCRef = function() { return this.replace(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g, function($0, $1){ return '&#x' + String($1).toCodePoints()[0].toString(16) + ';'; }) };

    Node.js : UTF8の4バイト文字は無理矢理クライアント処理する : typeOf 'aki_mana'
    nilab
    nilab 2015/03/05
    Node.js : UTF8の4バイト文字は無理矢理クライアント処理する : typeOf 'aki_mana' : 「クライアント側で「数値参照」に加工」
  • ECMAScript.next: TC39’s July 2012 meeting

    TC39 (Technical Committee 39) works on the upcoming ECMAScript.next [1] standard. They have several meetings per year and in July, there was another one. This blog post summarizes the most important decisions. It is based on the following minutes by Rick Waldron: July 24, 2012 July 25, 2012 July 26, 2012 Introduction In this post, I have omitted all decisions that concern minor details or that it

    nilab
    nilab 2012/08/16
    ECMAScript.next: TC39’s July 2012 meeting : "<<some emoji>>" === "\u{1F601}" === "\uD83D\uDE01" : String.fromCodePoint, String.prototype.codePointAt
  • 1