1 /* Unicode character output to streams with locale dependent encoding.
3 Copyright (C) 2000-2003, 2005, 2008-2017 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
24 /* Converts the Unicode character CODE to its multibyte representation
25 in the current locale and calls the SUCCESS callback on the resulting
26 byte sequence. If an error occurs, invokes the FAILURE callback instead,
27 passing it CODE and an English error string.
28 Returns whatever the callback returned.
29 Assumes that the locale doesn't change between two calls. */
30 extern long unicode_to_mb (unsigned int code
,
31 long (*success
) (const char *buf
, size_t buflen
,
33 long (*failure
) (unsigned int code
, const char *msg
,
37 /* Outputs the Unicode character CODE to the output stream STREAM.
38 Upon failure, exit if exit_on_error is true, otherwise output a fallback
40 extern void print_unicode_char (FILE *stream
, unsigned int code
,
43 /* Simple success callback that outputs the converted string.
44 The STREAM is passed as callback_arg. */
45 extern long fwrite_success_callback (const char *buf
, size_t buflen
,