ypr0: Correct .scrobbler.log path for YPR0
[maemo-rb.git] / firmware / include / rbunicode.h
blobd21a840b00e9c53571b088438c8f2c983f358bce
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (c) 2004,2005 by Marcoen Hirschberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 /* Some conversion functions for handling UTF-8
23 * I got all the info from:
24 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
25 * and
26 * http://en.wikipedia.org/wiki/Unicode
28 #ifndef _RBUNICODE_H_
29 #define _RBUNICODE_H_
31 #include "config.h"
33 #define MASK 0xC0 /* 11000000 */
34 #define COMP 0x80 /* 10x */
36 #ifdef HAVE_LCD_BITMAP
38 enum codepages {
39 ISO_8859_1 = 0, /* Latin1 */
40 ISO_8859_7, /* Greek */
41 ISO_8859_8, /* Hebrew */
42 WIN_1251, /* Cyrillic */
43 ISO_8859_11, /* Thai */
44 WIN_1256, /* Arabic */
45 ISO_8859_9, /* Turkish */
46 ISO_8859_2, /* Latin Extended */
47 WIN_1250, /* Central European */
48 WIN_1252, /* Western European */
49 SJIS, /* Japanese */
50 GB_2312, /* Simp. Chinese */
51 KSX_1001, /* Korean */
52 BIG_5, /* Trad. Chinese */
53 UTF_8, /* Unicode */
54 NUM_CODEPAGES
57 #else /* !HAVE_LCD_BITMAP, reduced support */
59 enum codepages {
60 ISO_8859_1 = 0, /* Latin1 */
61 ISO_8859_7, /* Greek */
62 WIN_1251, /* Cyrillic */
63 ISO_8859_9, /* Turkish */
64 ISO_8859_2, /* Latin Extended */
65 WIN_1250, /* Central European */
66 WIN_1252, /* Western European */
67 UTF_8, /* Unicode */
68 NUM_CODEPAGES
71 #endif
73 /* Encode a UCS value as UTF-8 and return a pointer after this UTF-8 char. */
74 unsigned char* utf8encode(unsigned long ucs, unsigned char *utf8);
75 unsigned char* iso_decode(const unsigned char *latin1, unsigned char *utf8, int cp, int count);
76 unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
77 unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
78 unsigned long utf8length(const unsigned char *utf8);
79 const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs);
80 void set_codepage(int cp);
81 int utf8seek(const unsigned char* utf8, int offset);
82 const char* get_codepage_name(int cp);
83 #endif /* _RBUNICODE_H_ */