Module: IDN::Stringprep
- Defined in:
- ext/stringprep.c
Class Method Summary collapse
-
.IDN::Stringprep.nameprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Nameprep’ profile.
-
.IDN::Stringprep.nfkc_normalize(string) ⇒ String
Converts a string in UTF-8 format into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character.
-
.IDN::Stringprep.nodeprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Nodeprep’ profile.
-
.IDN::Stringprep.resourceprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Resourceprep’ profile.
-
.IDN::Stringprep.with_profile(string, profile) ⇒ String
Prepares a string in UTF-8 format according to the given stringprep profile name which must be one of the internally supported stringprep profiles (for details see IANA’s Profile Names in RFC3454).
Class Method Details
.IDN::Stringprep.nameprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Nameprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
90 91 92 93 |
# File 'ext/stringprep.c', line 90 static VALUE nameprep(VALUE self, VALUE str) { return stringprep_internal(str, "Nameprep"); } |
.IDN::Stringprep.nfkc_normalize(string) ⇒ String
Converts a string in UTF-8 format into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character.
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'ext/stringprep.c', line 151 static VALUE nfkc_normalize(VALUE self, VALUE str) { char *buf; VALUE retv; str = rb_check_convert_type(str, T_STRING, "String", "to_s"); buf = stringprep_utf8_nfkc_normalize(RSTRING_PTR(str), RSTRING_LEN(str)); retv = rb_utf8_str_new_cstr(buf); idn_free(buf); return retv; } |
.IDN::Stringprep.nodeprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Nodeprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
105 106 107 108 |
# File 'ext/stringprep.c', line 105 static VALUE nodeprep(VALUE self, VALUE str) { return stringprep_internal(str, "Nodeprep"); } |
.IDN::Stringprep.resourceprep(string) ⇒ String
Prepares a string in UTF-8 format according to the ‘Resourceprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
120 121 122 123 |
# File 'ext/stringprep.c', line 120 static VALUE resourceprep(VALUE self, VALUE str) { return stringprep_internal(str, "Resourceprep"); } |
.IDN::Stringprep.with_profile(string, profile) ⇒ String
Prepares a string in UTF-8 format according to the given stringprep profile name which must be one of the internally supported stringprep profiles (for details see IANA’s Profile Names in RFC3454).
Raises IDN::Stringprep::StringprepError on failure.
136 137 138 139 140 |
# File 'ext/stringprep.c', line 136 static VALUE with_profile(VALUE self, VALUE str, VALUE profile) { profile = rb_check_convert_type(profile, T_STRING, "String", "to_s"); return stringprep_internal(str, RSTRING_PTR(profile)); } |