2019-07-28 01:02:24 +03:00
|
|
|
import { BytesLike } from "@ethersproject/bytes";
|
|
|
|
export declare enum UnicodeNormalizationForm {
|
|
|
|
current = "",
|
|
|
|
NFC = "NFC",
|
|
|
|
NFD = "NFD",
|
|
|
|
NFKC = "NFKC",
|
|
|
|
NFKD = "NFKD"
|
|
|
|
}
|
2020-01-21 03:43:50 +03:00
|
|
|
export declare enum Utf8ErrorReason {
|
|
|
|
UNEXPECTED_CONTINUE = "unexpected continuation byte",
|
|
|
|
BAD_PREFIX = "bad codepoint prefix",
|
|
|
|
OVERRUN = "string overrun",
|
|
|
|
MISSING_CONTINUE = "missing continuation byte",
|
|
|
|
OUT_OF_RANGE = "out of UTF-8 range",
|
|
|
|
UTF16_SURROGATE = "UTF-16 surrogate",
|
|
|
|
OVERLONG = "overlong representation"
|
|
|
|
}
|
|
|
|
export declare type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number) => number;
|
|
|
|
export declare const Utf8ErrorFuncs: {
|
|
|
|
[name: string]: Utf8ErrorFunc;
|
|
|
|
};
|
2019-07-28 01:02:24 +03:00
|
|
|
export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
|
2020-01-21 03:43:50 +03:00
|
|
|
export declare function _toEscapedUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
|
2019-08-02 09:10:58 +03:00
|
|
|
export declare function _toUtf8String(codePoints: Array<number>): string;
|
2020-01-21 03:43:50 +03:00
|
|
|
export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
|
2019-07-28 01:02:24 +03:00
|
|
|
export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array<number>;
|