1uconvert(3) Allegro manual uconvert(3)
2
3
4
6 uconvert - High level string encoding conversion wrapper. Allegro game
7 programming library.
8
10 #include <allegro.h>
11
12
13 char *uconvert(const char *s, int type, char *buf, int newtype, int
14 size);
15
17 Higher level function running on top of do_uconvert(). This function
18 converts the specified string `s' from `type' to `newtype', storing at
19 most `size' bytes into the output `buf' (including the terminating null
20 character), but it checks before doing the conversion, and doesn't
21 bother if the string formats are already the same (either both types
22 are equal, or one is ASCII, the other is UTF-8, and the string contains
23 only 7-bit ASCII characters).
24
25 As a convenience, if `buf' is NULL it will convert the string into an
26 internal static buffer and the `size' parameter will be ignored. You
27 should be wary of using this feature, though, because that buffer will
28 be overwritten the next time this routine is called, so don't expect
29 the data to persist across any other library calls. The static buffer
30 may hold less than 1024 characters, so you won't be able to convert
31 large chunks of text. Example:
32
33 char *p = uconvert(input_string, U_CURRENT, buffer, U_ASCII, 256);
34
36 Returns a pointer to `buf' (or the static buffer if you used NULL) if a
37 conversion was performed. Otherwise returns a copy of `s'. In any
38 cases, you should use the return value rather than assuming that the
39 string will always be moved to `buf'.
40
41
43 set_uformat(3), need_uconvert(3), uconvert(3), uconvert_ascii(3), ucon‐
44 vert_toascii(3), do_uconvert(3)
45
46
47
48Allegro version 4.4.3 uconvert(3)