[Mapguide-trac] [mapguide-trac] #2845: FAILED Server Tests - Int32ToLocaleSpecificString ( Util.cpp) versus MgIsLegalUTF8 (ConvertUTF.c)

MapGuide Open Source trac_mapguide at osgeo.org
Sun Jun 5 05:57:42 PDT 2022


#2845: FAILED Server Tests -  Int32ToLocaleSpecificString  ( Util.cpp)  versus
MgIsLegalUTF8 (ConvertUTF.c)
-------------------------+-------------------------------------------------
   Reporter:  pcardinal  |      Owner:  (none)
       Type:  defect     |     Status:  new
   Priority:  medium     |  Milestone:  4.0
  Component:  Mapping    |    Version:
  Service                |   Keywords:  Unbreakable blank space utf-8
   Severity:  minor      |  server test MgIsLegalUTF8
External ID:             |
-------------------------+-------------------------------------------------
 FAILED Server test MappingService

 GetMultiPlot
 -----------------------------------------------------------------------------
 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


 GetPlotUsingExtents
 -----------------------------------------------------------------------------
 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)
-- 
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/2845>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list