diff --git a/cp1252/cp1252.c b/cp1252/cp1252.c index a6d8659..9029c45 100644 --- a/cp1252/cp1252.c +++ b/cp1252/cp1252.c @@ -144,7 +144,7 @@ char getCP1252FromUnicode(uint32_t input) { return (char)input; } else { - return '\x20'; // SPACE + return '\x3F'; // QUESTION MARK } } } @@ -274,4 +274,20 @@ char* getCP1252String(const char* input) { return ret; } +char toupperCP1252(char c) { + if (c >= 'a' && c <= 'z') { + c -= 32; + } + else if (c == '\x9A' || c == '\x9C' || c == '\x9E') { + c -= 16; + } + else if ((c >= '\xE0' && c <= '\xF6') || (c >= '\xF8' && c <= '\xFE')) { + c -= 32; + } + else if (c == '\xFF') { + c = '\x9F'; + } + return c; +} + #endif //CP1252_INCLUDED diff --git a/extract-xiso.c b/extract-xiso.c index edd0bfc..2b1f3a6 100644 --- a/extract-xiso.c +++ b/extract-xiso.c @@ -1568,11 +1568,8 @@ int avl_compare_key( const char *in_lhs, const char *in_rhs ) { unsigned char a, b; for ( ;; ) { - a = (unsigned char)*in_lhs++; - b = (unsigned char)*in_rhs++; - - if ( a >= 'a' && a <= 'z' ) a -= 32; // uppercase(a); - if ( b >= 'a' && b <= 'z' ) b -= 32; // uppercase(b); + a = (unsigned char)toupperCP1252(*in_lhs++); + b = (unsigned char)toupperCP1252(*in_rhs++); if ( a ) { if ( b ) {