BUG: UPPER() and LOWER() under Win32
am 05.08.2002 15:32:11 von vi.kSorry 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
#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.k@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
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread12281@lists.mysql.com
To unsubscribe, e-mail