Opened 2 years ago
Closed 2 years ago
#2845 closed defect (fixed)
FAILED Server Tests - Int32ToLocaleSpecificString ( Util.cpp) versus MgIsLegalUTF8 (ConvertUTF.c)
Reported by: | pcardinal | Owned by: | jng |
---|---|---|---|
Priority: | medium | Milestone: | 4.0 |
Component: | Mapping Service | Version: | |
Severity: | minor | Keywords: | Unbreakable blank space utf-8 server test MgIsLegalUTF8 |
Cc: | pcardinal | External ID: |
Description
FAILED Server test MappingService
d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(338) ............................................................................ d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(419): FAILED: explicitly with message:
Invalid argument(s):
[1] = "const string&"
The string is invalid and cannot be converted.
- MgServerMappingService.GenerateMultiPlot() line 670 file d:\
MgDev_4.0\Server\src\Services\Mapping\ServerMappingService.cpp
- MgUtil.WideCharToMultiByte() line 296 file d:\MgDev_4.0\ Common\Foundation\System\Util.cpp
GetPlotUsingOverriddenCenterAndScale
d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(478) ............................................................................. d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(520): FAILED:
explicitly with message:
Invalid argument(s):
[1] = "const string&"
The string is invalid and cannot be converted.
- MgServerMappingService.GeneratePlot() line 237 file d:\MgDev_4.0\Server\src\Services\Mapping\ServerMappingService.cpp
- MgServerMappingService.GenerateMultiPlot() line 670 file d:\MgDev_4.0\Server\src\Services\Mapping\ServerMappingService.cpp
- MgUtil.WideCharToMultiByte() line 296 file d:\MgDev_4.0\Common\Foundation\System\Util.cpp
d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(528) ...........................................................................
d:\MgDev_4.0\Server\src\UnitTesting\TestMappingService.cpp(570): FAILED: explicitly with message:
Invalid argument(s):
[1] = "const string&"
The string is invalid and cannot be converted.
- MgServerMappingService.GeneratePlot() line 305 file d:\MgDev_4.0\Server\src\Services\Mapping\ServerMappingService.cpp
- MgServerMappingService.GenerateMultiPlot() line 670 file d:\MgDev_4.0\Server\src\Services\Mapping\ServerMappingService.cpp
- MgUtil.WideCharToMultiByte() line 296 file d:\MgDev_4.0\Common\Foundation\System\Util.cpp
Under Windows, the digit grouping symbol in many localisations (and international system) is the Unbrekable blank space (code UTF-8 is decimal 160, hex 0xA0). Example : 200 000 000
With french localisation, the function Int32ToLocaleSpecificString will generate a string with Unbreakble blank space for digit grouping symbol. The integer 200000000 will become the string "200 000 000"
[0] 50 '2' char [1] 48 '0' char [2] 48 '0' char [3] -96 ' ' char [4] 48 '0' char [5] 48 '0' char [6] 48 '0' char [7] -96 ' ' char [8] 48 '0' char [9] 48 '0' char [10] 48 '0' char
However, the function MgIsLegalUTF8 return False for the said string because the Unbrekable blank space caracter has a value of 0xA0 whitch is outside the one byte UTF-8 encoding for a caracter.
https://www.fileformat.info/info/unicode/char/00a0/index.htm
1-byte characters in UTF-8 are ASCII Characters 0-127.
line of code in MgIsLegalUTF8
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
(case 1 is for one byte UTF-8 encoding)
Attachments (1)
Change History (4)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
In function MgIsLegalUTF8
With
case 1: if ((*source >= 0x80 && *source < 0xC2) && (*source != 0xA0)) return false;
Instead of
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
the test does pass.
If we add an explicit test for unicode nbsp character in MgIsLegalUTF8, does the test pass?