Skip to content

Commit

Permalink
UTF-32ビッグエンディアンをUTF-16に変換する関数にて、基本多言語面以外の場合の変換誤りを修正 (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki-oogakiuchi committed Mar 24, 2023
1 parent 3b1dbbc commit 9e8fa57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sakura_core/charset/CCodePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ int CCodePage::S_UTF32BEToUnicode( const char* pSrc, int nSrcLen, wchar_t* pDst,
}else if( pSrcByte[i] == 0x00 && pSrcByte[i+1] <= 0x10 ){
nDstUseCharLen = 2;
if( nDstUseLen + nDstUseCharLen <= nDstLen ){
UINT c = (pSrcByte[i+3] << 16) | (pSrcByte[i+2] << 8) | pSrcByte[i+1];
UINT c = (pSrcByte[i+1] << 16) | (pSrcByte[i+2] << 8) | pSrcByte[i+3];
UINT x = c - 0x10000;
pDst[nDstUseLen] = static_cast<wchar_t>(0xd800 | (x >> 10));
pDst[nDstUseLen+1] = static_cast<wchar_t>(0xdc00 | (x & 0x3ff));
Expand Down

0 comments on commit 9e8fa57

Please sign in to comment.