OSDN Git Service

Convert Unicode chars outside BMP to surrogate pairs
authorsdottaka <none@none>
Wed, 20 Jul 2011 16:51:43 +0000 (01:51 +0900)
committersdottaka <none@none>
Wed, 20 Jul 2011 16:51:43 +0000 (01:51 +0900)
Src/Common/unicoder.cpp

index ce09bff..19cb7af 100644 (file)
@@ -590,6 +590,12 @@ void maketchar(String & ch, unsigned int unich, bool & lossy, unsigned int codep
                ch = (TCHAR)unich;
                return;
        }
+       else if (unich < 0x110000)
+       {
+               ch = ((unich - 0x10000)/0x400 + 0xd800);
+               ch += ((unich % 0x400) + 0xdc00);
+               return;
+       }
        lossy = TRUE;
        ch = '?';
        return;