2014-11-09から1日間の記事一覧

RubyでJSのURIエンコードを

先にまとめ JavaScript の encodeURIComponent と encodeURI と同じエンコードするメソッドを String クラスに作るモンキーパッチ。 class String def encodeURIComponent unescaped_form = /([#{Regexp.escape(';/?:@&=+$,<>#%"{}|\\^[]`' + (0x0..0x1f).ma…