hscdio-0.1.0.0: Haskell bindings to the libcdio disc-reading library.
Copyright(c) 2020-2021 Sam May
LicenseGPL-3.0-or-later
Maintainerag@eitilt.life
Stabilitystable
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Text.Encoding.MsJIS

Description

The CdText standard technically allows for data encoded as Shift JIS; I am unaware of any discs produced with such data as no member of the libcdio-dev mailing list (or any of the very few other resources) have Japanese imports, but for completion the ability to read that encoding is required. This module provides a light-weight implementation modeled on the Data.Text.Encoding UTF-8 interface.

Synopsis

Types

data JISChar Source #

The characters which may be represented under the Shift JIS encoding. Note that this type is only exposed as part of error reporting or recovery functions, and is not intended as a replacement of Char.

Constructors

Single Word8 
Double Word8 Word8 

Instances

Instances details
Bounded JISChar Source # 
Instance details

Defined in Data.Text.Encoding.MsJIS

Enum JISChar Source #

Ignores the three invalid single-byte characters "xFDxFExFF", and any double-byte characters outside the primary range ([0x81..0x9F]++[0xE0..0xFC], [0x40..0xFC]). fromEnum any such "invalid" characters will overlap with the canonical characters, and the result should not be relied upon to remain consistent between versions.

>>> succ $ Single 0xFC
Double 0x81 0x40
>>> succ $ Double 0x9F 0xFC
Double 0xE0 0x40
Instance details

Defined in Data.Text.Encoding.MsJIS

Eq JISChar Source # 
Instance details

Defined in Data.Text.Encoding.MsJIS

Methods

(==) :: JISChar -> JISChar -> Bool #

(/=) :: JISChar -> JISChar -> Bool #

Ord JISChar Source # 
Instance details

Defined in Data.Text.Encoding.MsJIS

Read JISChar Source # 
Instance details

Defined in Data.Text.Encoding.MsJIS

Show JISChar Source # 
Instance details

Defined in Data.Text.Encoding.MsJIS

data JISDecodeError Source #

The given one- or two- byte sequence was unable to be decoded; the error may be described by the unstructured text.

data JISEncodeError Source #

The given character was unable to be serialized in binary form; this is almost certainly due to it not being included in Shift JIS, but the error is described by the unstructured text anyway.

Transformations

Decode

decodeMsJIS' :: ByteString -> Either JISDecodeError Text Source #

Transform a ByteString into unambiguous Chars according to Microsoft's extension of the Shift JIS encoding scheme.

If the input contains any invalid sequences under that scheme, the first byte(s) which triggered an error will be returned instead.

decodeMsJISWith :: OnError JISChar Char -> ByteString -> Text Source #

Transform a ByteString into unambiguous Chars according to Microsoft's extension of the Shift JIS encoding scheme.

Encode

encodeMsJIS' :: Text -> Either JISEncodeError ByteString Source #

Transform an unambiguous string into a binary stream according to Microsoft's extension of the Shift JIS encoding scheme.

If the input contains any characters without an associated binary sequence under that scheme, the first such character which triggers the error will be returned instead.

encodeMsJISWith :: OnError Char ByteString -> Text -> ByteString Source #

Transform an unambiguous string into a binary stream according to Microsoft's extension of the Shift JIS encoding scheme.