Module: CGI::Escape
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| 
       Extended In: 
      
     | |
| Defined in: | ext/cgi/escape/escape.c | 
Instance Method Summary
- 
    
      CGI.escape(string)  ⇒ String 
    
    
Returns URL-escaped string (
application/x-www-form-urlencoded). - 
    
      #escape_uri_component(string)  ⇒ String 
    
    
Alias for #escapeURIComponent.
 - 
    
      CGI.escapeHTML(string)  ⇒ String 
    
    
Returns HTML-escaped string.
 - 
    
      CGI.escapeURIComponent(string)  ⇒ String 
      (also: #escape_uri_component)
    
    
Returns URL-escaped string following RFC 3986.
 - 
    
      CGI.unescape(string, encoding = @@accept_charset)  ⇒ String 
    
    
Returns URL-unescaped string (
application/x-www-form-urlencoded). - 
    
      #unescape_uri_component(string, encoding = @@accept_charset)  ⇒ String 
    
    
Alias for #unescapeURIComponent.
 - 
    
      CGI.unescapeHTML(string)  ⇒ String 
    
    
Returns HTML-unescaped string.
 - 
    
      CGI.unescapeURIComponent(string, encoding = @@accept_charset)  ⇒ String 
      (also: #unescape_uri_component)
    
    
Returns URL-unescaped string following RFC 3986.
 
Instance Method Details
    CGI.escape(string)  ⇒ String   
Returns URL-escaped string (application/x-www-form-urlencoded).
# File 'ext/cgi/escape/escape.c', line 373
static VALUE
cgiesc_escape(VALUE self, VALUE str)
{
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        return optimized_escape(str, 1);
    }
    else {
        return rb_call_super(1, &str);
    }
}
  
    
      CGI.escapeURIComponent(string)  ⇒ String 
      #escape_uri_component(string)  ⇒ String 
    
  
String 
      #escape_uri_component(string)  ⇒ String 
    Alias for #escapeURIComponent.
    CGI.escapeHTML(string)  ⇒ String   
Returns HTML-escaped string.
# File 'ext/cgi/escape/escape.c', line 333
static VALUE
cgiesc_escape_html(VALUE self, VALUE str)
{
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        return optimized_escape_html(str);
    }
    else {
        return rb_call_super(1, &str);
    }
}
  
    CGI.escapeURIComponent(string)  ⇒ String     Also known as: #escape_uri_component
  
Returns URL-escaped string following RFC 3986.
# File 'ext/cgi/escape/escape.c', line 424
static VALUE
cgiesc_escape_uri_component(VALUE self, VALUE str)
{
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        return optimized_escape(str, 0);
    }
    else {
        return rb_call_super(1, &str);
    }
}
  
    CGI.unescape(string, encoding = @@accept_charset)  ⇒ String   
Returns URL-unescaped string (application/x-www-form-urlencoded).
# File 'ext/cgi/escape/escape.c', line 401
static VALUE
cgiesc_unescape(int argc, VALUE *argv, VALUE self)
{
    VALUE str = (rb_check_arity(argc, 1, 2), argv[0]);
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        VALUE enc = accept_charset(argc-1, argv+1, self);
        return optimized_unescape(str, enc, 1);
    }
    else {
        return rb_call_super(argc, argv);
    }
}
  
    
      CGI.unescapeURIComponent(string, encoding = @@accept_charset)  ⇒ String 
      #unescape_uri_component(string, encoding = @@accept_charset)  ⇒ String 
    
  
String 
      #unescape_uri_component(string, encoding = @@accept_charset)  ⇒ String 
    Alias for #unescapeURIComponent.
    CGI.unescapeHTML(string)  ⇒ String   
Returns HTML-unescaped string.
# File 'ext/cgi/escape/escape.c', line 353
static VALUE
cgiesc_unescape_html(VALUE self, VALUE str)
{
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        return optimized_unescape_html(str);
    }
    else {
        return rb_call_super(1, &str);
    }
}
  
    CGI.unescapeURIComponent(string, encoding = @@accept_charset)  ⇒ String     Also known as: #unescape_uri_component
  
Returns URL-unescaped string following RFC 3986.
# File 'ext/cgi/escape/escape.c', line 444
static VALUE
cgiesc_unescape_uri_component(int argc, VALUE *argv, VALUE self)
{
    VALUE str = (rb_check_arity(argc, 1, 2), argv[0]);
    StringValue(str);
    if (rb_enc_str_asciicompat_p(str)) {
        VALUE enc = accept_charset(argc-1, argv+1, self);
        return optimized_unescape(str, enc, 0);
    }
    else {
        return rb_call_super(argc, argv);
    }
}