From b53263fe91e438c564d720b3b5b0dc204dc309b9 Mon Sep 17 00:00:00 2001 From: Juha Date: Wed, 25 Dec 2024 02:18:10 +0200 Subject: [PATCH] LazUtils, LConvEncoding: Fix CP932 (Shift_JIS). Issue #41277, patch by rasberryrabbit. (cherry picked from commit ef08272eb62ad2bc0d194171a66b5e9e5c740de3) --- .../lazutils/asiancodepagefunctions.inc | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/components/lazutils/asiancodepagefunctions.inc b/components/lazutils/asiancodepagefunctions.inc index 7ff8609f4f..85723891bc 100644 --- a/components/lazutils/asiancodepagefunctions.inc +++ b/components/lazutils/asiancodepagefunctions.inc @@ -41,13 +41,22 @@ begin end else begin - code := Byte(c) shl 8; - c:=Src^; - Lbyte := byte(Src^); - if (c=#0) and (Src-PChar(s)>=len) then break; - code := code + Byte(c); - code1:=code; - Inc(Src); + // shift-jis halfwidth + if (CodeP=932) and (c in [#$a0..#$df,#$fd..#$ff]) then + begin + code := Byte(c); + code1:= code; + end + else + begin + code := Byte(c) shl 8; + c:=Src^; + Lbyte := byte(Src^); + if (c=#0) and (Src-PChar(s)>=len) then break; + code := code + Byte(c); + code1:=code; + Inc(Src); + end; code := ArrayUni[SearchTable(ArrayCP, code)]; if code=0 then