25#include <proto/codesets.h>
26#include <proto/exec.h>
27#include <proto/utility.h>
38 ULONG utf8_tag = CSA_SourceCodeset, local_tag = CSA_DestCodeset, len_tag = CSA_SourceLen;
39 static struct codeset *utf8_cs = NULL;
40 static struct codeset *local_cs = NULL;
42 if(local_cs == NULL) local_cs = CodesetsFind(NULL,
50 if(utf8_cs == NULL) utf8_cs = CodesetsFind(NULL,
51 CSA_MIBenum, CS_MIBENUM_UTF_8,
54 if(to_local ==
false) {
55 local_tag = CSA_SourceCodeset;
56 utf8_tag = CSA_DestCodeset;
59 if(len == 0) len_tag = TAG_IGNORE;
61 out = CodesetsConvertStr(CSA_Source,
string,
67 CSA_MapForeignChars, TRUE,
72 CodesetsFreeA(out, NULL);
82 if(__builtin_expect((CodesetsBase == NULL), 0)) {
91 if(__builtin_expect((CodesetsBase == NULL), 0)) {
96 FreeVec(local_charset);
115 return strdup(
string);
126 return strdup(
string);
nserror
Enumeration of error codes.
@ NSERROR_BAD_ENCODING
The character set is unknown.
@ NSERROR_NOMEM
Memory exhaustion.
static nserror ami_utf8_codesets(const char *string, size_t len, char **result, bool to_local)
void ami_utf8_free(char *ptr)
static struct gui_utf8_table utf8_table
struct gui_utf8_table * amiga_utf8_table
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
char * ami_to_utf8_easy(const char *string)
char * ami_utf8_easy(const char *string)
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
Interface to platform-specific utf8 operations.
char * ASPrintf(const char *fmt,...)
Minimal compatibility header for AmigaOS 3.
Interface to utility string handling.
User interface utf8 characterset conversion routines.
nserror(* utf8_to_local)(const char *string, size_t len, char **result)
Convert a UTF-8 encoded string into the system local encoding.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_int(OPTION)
Get the value of an integer option.
nserror utf8_from_enc(const char *string, const char *encname, size_t len, char **result, size_t *result_len)
Convert a string in the named encoding into a UTF-8 string.
nserror utf8_to_enc(const char *string, const char *encname, size_t len, char **result)
Convert a UTF8 string into the named encoding.
UTF-8 manipulation functions (interface).