Module | IDN::Stringprep |
In: |
ext/idna.c
|
The Stringprep module of LibIDN Ruby Bindings.
require 'idn' include IDN str = Stringprep.with_profile('FOO', 'Nameprep')
Prepares a string in UTF-8 format according to the ‘Nameprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
/* * call-seq: * IDN::Stringprep.nameprep(string) => string * * Prepares a string in UTF-8 format according to the 'Nameprep' * profile. * * Raises IDN::Stringprep::StringprepError on failure. */ static VALUE nameprep(VALUE self, VALUE str) { return stringprep_internal(str, "Nameprep"); }
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.
/* * call-seq: * 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. */ 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(str)->ptr, RSTRING(str)->len); retv = rb_str_new2(buf); xfree(buf); return retv; }
Prepares a string in UTF-8 format according to the ‘Nodeprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
/* * call-seq: * IDN::Stringprep.nodeprep(string) => string * * Prepares a string in UTF-8 format according to the 'Nodeprep' * profile. * * Raises IDN::Stringprep::StringprepError on failure. */ static VALUE nodeprep(VALUE self, VALUE str) { return stringprep_internal(str, "Nodeprep"); }
Prepares a string in UTF-8 format according to the ‘Resourceprep’ profile.
Raises IDN::Stringprep::StringprepError on failure.
/* * call-seq: * IDN::Stringprep.resourceprep(string) => string * * Prepares a string in UTF-8 format according to the 'Resourceprep' * profile. * * Raises IDN::Stringprep::StringprepError on failure. */ static VALUE resourceprep(VALUE self, VALUE str) { return stringprep_internal(str, "Resourceprep"); }
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.
/* * call-seq: * 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. */ 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(profile)->ptr); }