00001
00024
00025
00026
00027
00028
00029
00030
00031 #include <sent/stddefs.h>
00032
00033 #ifdef CHARACTER_CONVERSION
00034
00035 static boolean convert_enabled = FALSE;
00036
00045 boolean
00046 j_printf_set_charconv(char *fromcode, char *tocode)
00047 {
00048 boolean enabled;
00049 boolean ret;
00050
00051
00052 #ifdef HAVE_ICONV
00053 ret = charconv_iconv_setup(fromcode, tocode, &enabled);
00054 #endif
00055 #ifdef USE_LIBJCODE
00056 ret = charconv_libjcode_setup(fromcode, tocode, &enabled);
00057 #endif
00058 #ifdef USE_WIN32_MULTIBYTE
00059 ret = charconv_win32_setup(fromcode, tocode, &enabled);
00060 #endif
00061
00062
00063 convert_enabled = enabled;
00064
00065
00066 return(ret);
00067 }
00068
00079 char *
00080 charconv(char *instr, char *outstr, int maxoutlen)
00081 {
00082 char *ret;
00083
00084
00085 if (convert_enabled == FALSE) return(instr);
00086
00087
00088 #ifdef HAVE_ICONV
00089 ret = charconv_iconv(instr, outstr, maxoutlen);
00090 #endif
00091 #ifdef USE_LIBJCODE
00092 ret = charconv_libjcode(instr, outstr, maxoutlen);
00093 #endif
00094 #ifdef USE_WIN32_MULTIBYTE
00095 ret = charconv_win32(instr, outstr, maxoutlen);
00096 #endif
00097
00098
00099
00100 return(ret);
00101 }
00102
00103 #endif