The Sleuth Kit 4.15.0-develop
tsk_unicode.h File Reference

Contains the definitions for Unicode-based conversion methods. More...

#include "tsk_base.h"

Unicode

typedef unsigned char Boolean
void tsk_cleanupUTF16 (TSK_ENDIAN_ENUM endian, wchar_t *source, size_t source_len, const wchar_t replacement)
 Cleans up the passed in string to replace invalid UTF-16 values with the passed in character.
void tsk_cleanupUTF8 (char *source, const char replacement)
 Cleans up the passed in string to replace invalid UTF-8 values with the passed in character.
Boolean tsk_isLegalUTF8Sequence (const UTF8 *source, const UTF8 *sourceEnd)
TSKConversionResult tsk_UTF16toUTF8 (TSK_ENDIAN_ENUM, const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-16 string to UTF-8.
TSKConversionResult tsk_UTF16toUTF8_lclorder (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-16 string in local endian ordering to UTF-8.
TSKConversionResult tsk_UTF16WtoUTF8_lclorder (const wchar_t **sourceStart, const wchar_t *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
TSKConversionResult tsk_UTF8toUTF16 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-8 string to UTF-16 (in local endian ordering).
enum  TSKConversionFlags { TSKstrictConversion = 0 , TSKlenientConversion }
enum  TSKConversionResult { TSKconversionOK , TSKsourceExhausted , TSKtargetExhausted , TSKsourceIllegal }
typedef unsigned short UTF16
typedef unsigned char UTF8

Detailed Description

Contains the definitions for Unicode-based conversion methods.

Enumeration Type Documentation

◆ TSKConversionFlags

Enumerator
TSKstrictConversion 

Error if invalid surrogate pairs are found.

TSKlenientConversion 

Ignore invalid surrogate pairs.

◆ TSKConversionResult

Enumerator
TSKconversionOK 

conversion successful

TSKsourceExhausted 

partial character in source, but hit end

TSKtargetExhausted 

insuff. room in target for conversion

TSKsourceIllegal 

source sequence is illegal/malformed

Function Documentation

◆ tsk_cleanupUTF16()

void tsk_cleanupUTF16 ( TSK_ENDIAN_ENUM endian,
wchar_t * source,
size_t source_len,
const wchar_t replacement )
extern

Cleans up the passed in string to replace invalid UTF-16 values with the passed in character.

Parameters
endianOrdering that data is stored in
sourceString to be cleaned up
source_lenNumber of wchar_t characters in source
replacementCharacter to insert into source as needed.

◆ tsk_cleanupUTF8()

void tsk_cleanupUTF8 ( char * source,
const char replacement )
extern

Cleans up the passed in string to replace invalid UTF-8 values with the passed in character.

Parameters
sourceString to be cleaned up
replacementCharacter to insert into source as needed.

Copyright © 2007-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.