#pragma once

// encoding functions (micro version)

enum encode_unicode
{
    encUTF8 = 0
};

// extract unicode character from utf-8
// optionally pass buffer top (points to 1 byte after buffer end)
// returns -1 on error; size holds number of bytes decoded
unichar charFromUTF8( const void *ptr, uint32 &size, const void *top = 0 );

// pack unicode character to utf-8
// optionally pass buffer top (points to 1 byte after buffer end)
// if ptr is 0, number of bytes required to encode ch is returned
// returns 0 on error, otherwise number of bytes written
uint32 charToUTF8( unichar ch, void *ptr, const void *top = 0 );
