Method: SimpleIDN::Punycode.encode_basic
- Defined in:
- lib/simpleidn.rb
.encode_basic(bcp, flag) ⇒ Object
encode_basic(bcp,flag) forces a basic code point to lowercase if flag is zero, uppercase if flag is nonzero, and returns the resulting code point. The code point is unchanged if it is caseless. The behavior is undefined if bcp is not a basic code point.
70 71 72 73 |
# File 'lib/simpleidn.rb', line 70 def encode_basic(bcp, flag) bcp -= (bcp - 97 < 26 ? 1 : 0) << 5 return bcp + ((!flag && (bcp - 65 < 26 ? 1 : 0)) << 5) end |