Conversion routines to support the Win437 text encoding scheme.
More...
|
static uint32_t | translate_from_UTF8 (const char *pInput) noexcept |
| Convert a single UTF8 stream character into a Win437 8 bit char.
|
|
static uintptr_t | translate_from_UTF8 (char *pOutput, uintptr_t uOutputSize, const char *pInput) noexcept |
| Convert a UTF8 stream into a Win437 "C" string.
|
|
static uintptr_t | translate_from_UTF8 (char *pOutput, uintptr_t uOutputSize, const char *pInput, uintptr_t uInputSize) noexcept |
| Convert a UTF8 stream into a Win437 byte array.
|
|
Conversion routines to support the Win437 text encoding scheme.
Win437 is a high ASCII encoding that's used by the MSDOS file system for MSDOS and Windows 95, etc. This class will allow the conversion of other character mappings to Win437 for use in calling Win32 API functions.
The character map for Win437 looks like this. Click here.
- See also
- Win1252, ISOLatin1, or MacRomanUS
◆ translate_from_UTF8() [1/3]
uintptr_t BURGER_API Burger::Win437::translate_from_UTF8 |
( |
char * | pOutput, |
|
|
uintptr_t | uOutputSize, |
|
|
const char * | pInput ) |
|
staticnoexcept |
Convert a UTF8 stream into a Win437 "C" string.
Take a "C" string that is using UTF8 encoding and convert it into a Win437 encoded "C" string. The function will return the size of the string after encoding. This size is valid, even if it exceeded the output buffer size. The output pointer and size can be nullptr to have this routine calculate the size of the possible output so the application can allocate a buffer large enough to hold it.
- Note
- This function will ensure that the string is always zero terminated, even if truncation is necessary to get it to fit in the output buffer. Under no circumstances will the output buffer be overrun.
- Parameters
-
pOutput | Pointer to byte buffer to receive the Win437 encoded string. nullptr is okay if uOutputSize is zero, otherwise it will page fault. |
uOutputSize | Size of the output buffer in bytes. |
pInput | A UTF8 encoded "C" string. nullptr will page fault. |
- Returns
- Burger::StringLength() of the potential output. It is valid, even if the output buffer wasn't large enough to contain everything.
◆ translate_from_UTF8() [2/3]
uintptr_t BURGER_API Burger::Win437::translate_from_UTF8 |
( |
char * | pOutput, |
|
|
uintptr_t | uOutputSize, |
|
|
const char * | pInput, |
|
|
uintptr_t | uInputSize ) |
|
staticnoexcept |
Convert a UTF8 stream into a Win437 byte array.
Take a byte array that is using UTF8 encoding and convert it to a Win437 encoded "C" string. The function will return the size of the string after encoding. This size is valid, even if it exceeded the output buffer size. The output pointer and size can be nullptr to have this routine calculate the size of the possible output so the application can allocate a buffer large enough to hold it.
- Note
- This function will ensure that the string is always zero terminated, even if truncation is necessary to get it to fit in the output buffer. Under no circumstances will the output buffer be overrun.
-
Zeros can be encoded into the stream. This function will not early out if a zero was parsed. Zeros will be placed in the Win437 stream as is.
- Parameters
-
pOutput | Pointer to a byte buffer to receive the Win437 string. nullptr is okay if uOutputSize is zero, otherwise a page fault will occur. |
uOutputSize | Size of the output buffer in bytes. |
pInput | UTF8 encoded byte array. nullptr is okay if uInputSize is zero. |
uInputSize | Size of the input byte array. |
- Returns
- Burger::StringLength() of the potential output. It is valid, even if the output buffer wasn't large enough to contain everything.
◆ translate_from_UTF8() [3/3]
uint32_t BURGER_API Burger::Win437::translate_from_UTF8 |
( |
const char * | pInput | ) |
|
|
staticnoexcept |
◆ g_LowerCaseTable
const uint8_t Burger::Win437::g_LowerCaseTable |
|
static |
Table to convert all characters to lower case.
Using Win437 mapping, this table will convert all 256 codes into their lower case equivalents.
◆ g_ToUTF16Table
const uint16_t Burger::Win437::g_ToUTF16Table |
|
static |
Table to convert Win437 to UTF16.
Since no Unicode token is larger than 16 bits, an array of uint16_t values holds the 128 high ascii codes for Win437 converted to UTF16. Some unprintable codes don't exist and are marked as themselves for the pattern. These are codes 0x81, 0x8D, 0x8F, 0x90 and 0x9D.
The character map for Win437 looks like this. Click here.
◆ g_ToUTF8Table
const uint8_t Burger::Win437::g_ToUTF8Table |
|
static |
Table to convert Win437 to UTF8.
This 128x4 array holds the 128 high ascii codes for Win437 converted to UTF8. Some unprintable codes don't exist and are marked as themselves for the pattern. These are codes 0x81, 0x8D, 0x8F, 0x90 and 0x9D.
The character map for Win437 looks like this. Click here.
◆ g_UpperCaseTable
const uint8_t Burger::Win437::g_UpperCaseTable |
|
static |
Table to convert all characters to upper case.
Using Win437 mapping, this table will convert all 256 codes into their upper case equivalents.