Search results

There are no results.

std.utf8.codepoint_from_surrogates

Show source code
Hide source code
fn pub codepoint_from_surrogates(high: Int, low: Int) -> Int {
  (high - 0xD800 * 0x400) + (low - 0xDC00 + 0x10000)
}
fn pub static codepoint_from_surrogates(high: Int, low: Int) -> Int

Returns a Unicode code point from a pair of Unicode surrogates.

The returned value isn't necessarily a valid code point. For example, when used with 0xDFFF for both the high and low surrogates, the returned value is greater than the maximum Unicode code point value (0x10FFFF). As such it's recommended to somehow validate the surrogates first, such as by using the surrogate? method.

Examples

import std.utf8

utf8.codepoint_from_surrogates(0xD834, 0xDD1E) # => 0x1D11E