| * Module for handling utf8 just like any other charset. |
| #include <linux/module.h> |
| #include <linux/kernel.h> |
| #include <linux/string.h> |
| static unsigned char identity[256]; |
| static int uni2char(wchar_t uni, unsigned char *out, int boundlen) |
| if ( (n = utf8_wctomb(out, uni, boundlen)) == -1) { |
| static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni) |
| if ( (n = utf8_mbtowc(uni, rawstring, boundlen)) == -1) { |
| static struct nls_table table = { |
| .charset2lower = identity, /* no conversion */ |
| .charset2upper = identity, |
| static int __init init_nls_utf8(void) |
| return register_nls(&table); |
| static void __exit exit_nls_utf8(void) |
| module_init(init_nls_utf8) |
| module_exit(exit_nls_utf8) |
| MODULE_LICENSE("Dual BSD/GPL"); |