diff options
author | jozan <jozan@noemail.net> | 2020-11-12 19:33:26 +0000 |
---|---|---|
committer | jozan <jozan@noemail.net> | 2020-11-12 19:33:26 +0000 |
commit | ff8fadf863431873e26a11814d65cbab48799038 (patch) | |
tree | 5e042e6f88a7a6e346fd68c8a991b862b3889888 | |
parent | Unicode in progress (diff) | |
download | unixize-ff8fadf863431873e26a11814d65cbab48799038.tar.gz unixize-ff8fadf863431873e26a11814d65cbab48799038.tar.bz2 unixize-ff8fadf863431873e26a11814d65cbab48799038.tar.xz unixize-ff8fadf863431873e26a11814d65cbab48799038.tar.zst unixize-ff8fadf863431873e26a11814d65cbab48799038.zip |
More unicode to come
FossilOrigin-Name: ff529030371279eaac4d47324b6387112e0e6ca1d83db09af19f9182771b87fc
-rw-r--r-- | src/c_subst.c | 73 | ||||
-rw-r--r-- | src/c_subst.h | 22 |
2 files changed, 72 insertions, 23 deletions
diff --git a/src/c_subst.c b/src/c_subst.c index cc9823c..31c2cde 100644 --- a/src/c_subst.c +++ b/src/c_subst.c @@ -208,11 +208,37 @@ c_unicode_subst(char filename[]) p = (unsigned char*)filename; while (*p != 0x00) { + if (*p == 0xc2) { + if (*(p + 1) == 0xb9) { + *p = '1'; + memmove( + p + 1, + p + 2, + (strlen((const char*)p + 2) + 1) * sizeof(char) + ); + c_unicode_subst(filename); + } + if (*(p + 1) == 0xb2) { + *p = '2'; + memmove( + p + 1, + p + 2, + (strlen((const char*)p + 2) + 1) * sizeof(char) + ); + c_unicode_subst(filename); + } + if (*(p + 1) == 0xb3) { + *p = '3'; + memmove( + p + 1, + p + 2, + (strlen((const char*)p + 2) + 1) * sizeof(char) + ); + c_unicode_subst(filename); + } + } if (*p == 0xc3) { - if ( - u_isucharset((unsigned char)*(p + 1), C_CHARSET_A_MAJ) == TRUE || - u_isucharset((unsigned char)*(p + 1), C_CHARSET_A_MIN) == TRUE - ) { + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_A) == TRUE) { *p = 'a'; memmove( p + 1, @@ -221,10 +247,7 @@ c_unicode_subst(char filename[]) ); c_unicode_subst(filename); } - if ( - u_isucharset((unsigned char)*(p + 1), C_CHARSET_O_MAJ) == TRUE || - u_isucharset((unsigned char)*(p + 1), C_CHARSET_O_MIN) == TRUE - ) { + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_O) == TRUE) { *p = 'o'; memmove( p + 1, @@ -246,26 +269,42 @@ c_unicode_subst(char filename[]) (strlen((const char*)p + 2) + 1) * sizeof(char) ); c_unicode_subst(filename); - } - if (*(p + 1) == 0x72) { - *p = '2'; + } + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_DH) == TRUE) { + *p = 'd'; + *(p + 1) = 'h'; + c_unicode_subst(filename); + } + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_C) == TRUE) { + *p = 'c'; memmove( p + 1, p + 2, (strlen((const char*)p + 2) + 1) * sizeof(char) ); c_unicode_subst(filename); - } - if (*(p + 1) == 0x73) { - *p = '3'; + } + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_E) == TRUE) { + *p = 'e'; + memmove( + p + 1, + p + 2, + (strlen((const char*)p + 2) + 1) * sizeof(char) + ); + c_unicode_subst(filename); + } + if (u_isucharset((unsigned char)*(p + 1), C_CHARSET_U) == TRUE) { + *p = 'u'; memmove( p + 1, p + 2, (strlen((const char*)p + 2) + 1) * sizeof(char) ); c_unicode_subst(filename); - } - if (*(p + 1) == 0x75) { + } + } + if (*p == 0xce) { + if (*(p + 1) == 0xbc) { *p = 'u'; memmove( p + 1, @@ -273,7 +312,7 @@ c_unicode_subst(char filename[]) (strlen((const char*)p + 2) + 1) * sizeof(char) ); c_unicode_subst(filename); - } + } } p++; } diff --git a/src/c_subst.h b/src/c_subst.h index 1a64621..e698632 100644 --- a/src/c_subst.h +++ b/src/c_subst.h @@ -51,12 +51,22 @@ #include "c_unixize.h" #define C_CHARSET_VALID "_-." -#define C_CHARSET_A_MAJ "\x80\x81\x82\x83\x84\x85" -#define C_CHARSET_A_MIN "\xa0\xa1\xa2\xa3\xa4\xa5" -#define C_CHARSET_O_MAJ "\x92\x93\x94\x95\x96\x98" -#define C_CHARSET_O_MIN "\xb2\xb3\xb4\xb5\xb6\xb8" -#define C_CHARSET_AE "\x86\xa6" -#define C_CHARSET_N "\x91\xb1" +#define C_CHARSET_A \ + "\x80\x81\x82\x83\x84\x85\xa0\xa1\xa2\xa3\xa4\xa5" +#define C_CHARSET_O \ + "\x92\x93\x94\x95\x96\x98\xb2\xb3\xb4\xb5\xb6\xb8" +#define C_CHARSET_AE \ + "\x86\xa6" +#define C_CHARSET_N \ + "\x91\xb1" +#define C_CHARSET_DH \ + "\x90\xb0" +#define C_CHARSET_C \ + "\x87\xa7" +#define C_CHARSET_E \ + "\x88\x89\x8a\x8b\xa8\xa9\xaa\xab" +#define C_CHARSET_U \ + "\x99\x9a\x9b\x9c\xb9\xba\xbb\xbc" struct lfiles_s* c_subst_filenames(struct lfiles_s*, const bool_t, const bool_t, const unsigned char); |