VirtualBox

Ignore:
Timestamp:
Jul 2, 2014 1:01:50 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94636
Message:

UTF-8 case folding hacks to deal with U+0130, U+0131, U+017f and U+01fbe since these doesn't have any roundtrip compatible mappings nor have case folds into codepoins with the same UTF-8 length. They map to other characters in other blocks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/utf-8-case.cpp

    r51770 r51795  
    290290        if (RT_SUCCESS(rc))
    291291        {
    292             uc = RTUniCpToLower(uc);
    293             pszDst = RTStrPutCp(pszDst, uc);
     292            RTUNICP uc2 = RTUniCpToLower(uc);
     293            if (RT_LIKELY(   uc2 == uc
     294                          || RTUniCpCalcUtf8Len(uc2) == RTUniCpCalcUtf8Len(uc)))
     295                pszDst = RTStrPutCp(pszDst, uc2);
     296            else
     297                pszDst = RTStrPutCp(pszDst, uc);
    294298        }
    295299        else
     
    323327        if (RT_SUCCESS(rc))
    324328        {
    325             uc = RTUniCpToUpper(uc);
    326             pszDst = RTStrPutCp(pszDst, uc);
     329            RTUNICP uc2 = RTUniCpToUpper(uc);
     330            if (RT_LIKELY(   uc2 == uc
     331                          || RTUniCpCalcUtf8Len(uc2) == RTUniCpCalcUtf8Len(uc)))
     332                pszDst = RTStrPutCp(pszDst, uc2);
     333            else
     334                pszDst = RTStrPutCp(pszDst, uc);
    327335        }
    328336        else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette