Skip to content

Commit

Permalink
Fix(Era): New line bug in WOG options dialog in Chinese
Browse files Browse the repository at this point in the history
Signed-off-by: VuceticBranislav <24853106+VuceticBranislav@users.noreply.github.com>
  • Loading branch information
VuceticBranislav committed Apr 27, 2024
1 parent 68a0c44 commit f72b07b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Era/Era.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ uses
Network in 'Network.pas',
ZlibUtils in 'ZlibUtils.pas',
Scripts in 'Scripts.pas',
Lua in 'Lua\Lua.pas';
Lua in 'Lua\Lua.pas',
Json in 'Json.pas';

begin
FormatSettings.DecimalSeparator := '.';
Expand Down
1 change: 1 addition & 0 deletions Era/Era.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ $(PostBuildEvent)]]></PostBuildEvent>
<DCCReference Include="ZlibUtils.pas"/>
<DCCReference Include="Scripts.pas"/>
<DCCReference Include="Lua\Lua.pas"/>
<DCCReference Include="Json.pas"/>
<None Include="VersionInfo.inc"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
Expand Down
40 changes: 20 additions & 20 deletions Era/Json.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1799,49 +1799,49 @@ class function TlkJSON.ParseText(const txt: myAStr): TlkJSONbase;
ridx := idx;
end;

{
}
function js_string(idx: integer; var ridx: integer; var o:
TlkJSONbase): boolean;

function strSpecialChars(const s: myAStr): myAStr;
var
i, j : integer;
utf8String, resultString: string;
begin
i := Pos('\', s);
utf8String := UTF8ToString(s);
i := System.Pos('\', utf8String);
if (i = 0) then
result := s
resultString := utf8String
else
begin
result := Copy(s, 1, i-1);
resultString := System.Copy(utf8String, 1, i-1);
j := i;
repeat
if (s[j] = '\') then
if (utf8String[j] = '\') then
begin
Inc(j);
case s[j] of
'\': result := result + '\';
'"': result := result + '"';
'''': result := result + '''';
'/': result := result + '/';
'b': result := result + #8;
'f': result := result + #12;
'n': result := result + #10;
'r': result := result + #13;
't': result := result + #9;
case utf8String[j] of
'\': resultString := resultString + '\';
'"': resultString := resultString + '"';
'''': resultString := resultString + '''';
'/': resultString := resultString + '/';
'b': resultString := resultString + #8;
'f': resultString := resultString + #12;
'n': resultString := resultString + #10;
'r': resultString := resultString + #13;
't': resultString := resultString + #9;
'u':
begin
result := result + myAStr(UTF8ToString(code2utf(strtoint('$' + copy(s, j + 1, 4)))));
resultString := resultString + UTF8ToString(code2utf(strtoint('$' + copy(utf8String, j + 1, 4))));
Inc(j, 4);
end;
end;
end
else
result := result + s[j];
resultString := resultString + utf8String[j];
Inc(j);
until j > Length(s);
until j > Length(utf8String);
end;
result := Utf8Encode(resultString);
end;

var
Expand Down

0 comments on commit f72b07b

Please sign in to comment.