1 message in com.mysql.lists.bugsBUG: UPPER() and LOWER() under Win32| From | Sent On | Attachments |
|---|---|---|
| vi.k | 05 Aug 2002 06:31 |
| Subject: | BUG: UPPER() and LOWER() under Win32![]() |
|---|---|
| From: | vi.k (vi...@mail.ru) |
| Date: | 08/05/2002 06:31:49 AM |
| List: | com.mysql.lists.bugs |
Sorry for my very bad English. I have small, very small knowledge and thick, very thick Russian-English dictionary and big, very big persistance :-)
Description: ===========
MySQL - 3.23.*, 4.0.* OS - 98, NT, 2K Charset - cp1251 (Russian) (as System default and as MySQL default).
Functions UPPER (UCASE) and LOWER (LCASE) work not correctly with national charsets. They must work correctly with Windows default charset only (i looked mysql code), but they work not correctly ("bugs" in Windows or Visual C++ std-library)... :-( With another charsets (default-character-set in my.ini) this functions don't work in general.
!!! The sorting work correctly !!!
Cause:
1. Fragment from m_ctype.h
#ifdef __WIN__ #include <ctype.h> #endif
#ifndef __WIN__ ... #define toupper(c) (char) my_to_upper[(uchar) (c)] #define tolower(c) (char) my_to_lower[(uchar) (c)] ... #define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U) #define islower(c) ((my_ctype+1)[(uchar) (c)] & _L) ... #endif /* __WIN__ */
2. Visual C++ (the dim memory from MSDN) Functions toupper, tolower, isupper, islower ... work correctly with standart C-locale only (ASCII).
How-To-Repeat: =============
1. Run sql-query: SELECT UPPER('national symbols in lower case'), LOWER('NATIONAL SYMBOLS IN UPPER CASE') Change default-character-set (for example: to cp1251, to koi8_ru, to cp866), restart mysqld and repeat.
The result changed with different mysqld (mysqld.exe, mysql-opt, mysqld-max ...). Exactly: with different VisualC++ std-libraries (DEBUG or RELEASE).
2. Write c- or cpp-code on VisualC++ with using functions setlocale(), toupper(), tolower() and look results.
Fix: ===
I slightly corrected m_ctype.h. (But i have not wish to download sources (i use modem 56K and pay for Internet) and recompile every new version of mysql)
I can send my version of m_ctype.h... if necessary.
Synopsis: Bug, simply bug... Submitter-Id: vi...@mail.ru Originator: vi.k MySQL support: none Severity: non-critical Priority: low Category: mysqld Class: sw-bug Release: 3.23.38, 3.23.49a, 4.0.1 Exectutable: any mysqld System: Win98, WinNT, Win2K




