1set_ucodepage(3) Allegro manual set_ucodepage(3)
2
3
4
6 set_ucodepage - Sets 8-bit to Unicode conversion tables. Allegro game
7 programming library.
8
10 #include <allegro.h>
11
12
13 void set_ucodepage(const unsigned short *table, const unsigned short
14 *extras);
15
17 When you select the U_ASCII_CP encoding mode, a set of tables are used
18 to convert between 8-bit characters and their Unicode equivalents. You
19 can use this function to specify a custom set of mapping tables, which
20 allows you to support different 8-bit codepages.
21
22 The `table' parameter points to an array of 256 shorts, which contain
23 the Unicode value for each character in your codepage. The `extras'
24 parameter, if not NULL, points to a list of mapping pairs, which will
25 be used when reducing Unicode data to your codepage. Each pair consists
26 of a Unicode value, followed by the way it should be represented in
27 your codepage. The list is terminated by a zero Unicode value. This
28 allows you to create a many->one mapping, where many different Unicode
29 characters can be represented by a single codepage value (eg. for
30 reducing accented vowels to 7-bit ASCII).
31
32 Allegro will use the `table' parameter when it needs to convert an
33 ASCII string to an Unicode string. But when Allegro converts an Unicode
34 string to ASCII, it will use both parameters. First, it will loop
35 through the `table' parameter looking for an index position pointing at
36 the Unicode value it is trying to convert (ie. the `table' parameter is
37 also used for reverse matching). If that fails, the `extras' list is
38 used. If that fails too, Allegro will put the character `^', giving up
39 the conversion.
40
41 Note that Allegro comes with a default `table' and `extras' parameters
42 set internally. The default `table' will convert 8-bit characters to
43 `^'. The default `extras' list reduces Latin-1 and Extended-A characā
44 ters to 7 bits in a sensible way (eg. an accented vowel will be reduced
45 to the same vowel without the accent).
46
47
49 set_uformat(3)
50
51
52
53Allegro version 4.2.2 set_ucodepage(3)