[−][src]Struct encoding::codec::simpchinese::GBEncoding
GBK and GB 18030-2005.
The original GBK 1.0 region spans [81-FE] [40-7E 80-FE]
, and is derived from
several different revisions of a family of encodings named "GBK":
- GBK as specified in the normative annex of GB 13000.1-93, the domestic standard equivalent to Unicode 1.1, consisted of characters included in Unicode 1.1 and not in GB 2312-80.
- Windows code page 936 is the widespread extension to GBK.
- Due to the popularity of Windows code page 936, a formal encoding based on Windows code page 936 (while adding new characters) was standardized into GBK 1.0.
- Finally, GB 18030 added four-byte sequences to GBK for becoming a pan-Unicode encoding, while adding new characters to the (former) GBK region again.
GB 18030-2005 is a simplified Chinese encoding which extends GBK 1.0 to a pan-Unicode encoding. It assigns four-byte sequences to every Unicode codepoint missing from the GBK area, lexicographically ordered with occasional "gaps" for codepoints in the GBK area. Due to this compatibility decision, there is no simple relationship between these four-byte sequences and Unicode codepoints, though there exists a relatively simple mapping algorithm with a small lookup table.
Specialization
This type is specialized with GBType T
,
which should be either GBK
or GB18030
.
Trait Implementations
impl<T: GBType> Encoding for GBEncoding<T>
[src]
fn name(&self) -> &'static str
[src]
fn whatwg_name(&self) -> Option<&'static str>
[src]
fn raw_encoder(&self) -> Box<dyn RawEncoder>
[src]
fn raw_decoder(&self) -> Box<dyn RawDecoder>
[src]
fn encode(
&self,
input: &str,
trap: EncoderTrap
) -> Result<Vec<u8>, Cow<'static, str>>
[src]
&self,
input: &str,
trap: EncoderTrap
) -> Result<Vec<u8>, Cow<'static, str>>
fn encode_to(
&self,
input: &str,
trap: EncoderTrap,
ret: &mut dyn ByteWriter
) -> Result<(), Cow<'static, str>>
[src]
&self,
input: &str,
trap: EncoderTrap,
ret: &mut dyn ByteWriter
) -> Result<(), Cow<'static, str>>
fn decode(
&self,
input: &[u8],
trap: DecoderTrap
) -> Result<String, Cow<'static, str>>
[src]
&self,
input: &[u8],
trap: DecoderTrap
) -> Result<String, Cow<'static, str>>
fn decode_to(
&self,
input: &[u8],
trap: DecoderTrap,
ret: &mut dyn StringWriter
) -> Result<(), Cow<'static, str>>
[src]
&self,
input: &[u8],
trap: DecoderTrap,
ret: &mut dyn StringWriter
) -> Result<(), Cow<'static, str>>
impl<T: Clone> Clone for GBEncoding<T>
[src]
fn clone(&self) -> GBEncoding<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for GBEncoding<T>
[src]
Auto Trait Implementations
impl<T> Send for GBEncoding<T> where
T: Send,
T: Send,
impl<T> Sync for GBEncoding<T> where
T: Sync,
T: Sync,
impl<T> Unpin for GBEncoding<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for GBEncoding<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for GBEncoding<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,