module function WEBrick::HTTPUtils.#escape

escape(str) -> String[permalink][rdoc][edit]

与えられた文字列を数値参照文字列に変換します。

以下の正規表現を使用して変換します。

control  = (0x0..0x1f).collect{|c| c.chr }.join + "\x7f"
space    = " "
delims   = '<>#%"'
unwise   = '{}|\\^[]`'
nonascii = (0x80..0xff).collect{|c| c.chr }.join
/[#{Regexp.escape(control + space + delims + unwise + nonascii)}]/n
[PARAM] str:
文字列を指定します。