View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006708 | JEDI Code Library | JclStringConversions | public | 2020-12-21 17:21 | 2023-11-11 23:49 |
Reporter | markjonesnz | Assigned To | AHUser | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Version 2.5 (Subversion repository/Daily zips) | ||||
Target Version | Fixed in Version | Version 2.5 (Subversion repository/Daily zips) | |||
Summary | 0006708: AnsiGetNextCharFromStream gives incorrect results for characters in extended range ($80 - $FF) | ||||
Description | The various AnsiGetNextChar* function give different results with FromStream giving a result that is not part of the current ansi code page. With a system code page of 1252 the following gives wrong result AnsiGetNextCharFromStream(Stream, Ch) The following however gives the correct result AnsiGetNextCharFromStream(Stream, 1252, Ch) | ||||
Steps To Reproduce | type String1252 = type AnsiString(1252); var S1, S2, S3, S4 : String1252; Ch: UCS4; ChArray: TUCS4Array; Bytes: TBytes; BytesStream: TBytesStream; Start: SizeInt; begin DefaultSystemCodePage := 1252; S1 := AnsiChar(WideChar($20AC)); //Euro assert(PByte(S1)^ = $80, 'Expected $80 for CP1252 Euro character'); SetLength(Bytes, 1); Bytes[0] := PByte(S1)^; BytesStream := TBytesStream.Create(Bytes); try assert(AnsiGetNextCharFromStream(BytesStream, Ch), 'AnsiGetNextCharFromStream failed'); S2 := UCS4ToAnsiChar(Ch); assert(S1 = S2, 'S1 <> S2'); BytesStream.Position := 0; assert(AnsiGetNextCharFromStream(BytesStream, 1252, Ch), 'AnsiGetNextCharFromStream (with CodePage) failed'); S3 := UCS4ToAnsiChar(Ch); assert(S1 = S3, 'S1 <> S3'); BytesStream.Position := 0; SetLength(ChArray, 1); Start := 0; assert(AnsiGetNextBufferFromStream(BytesStream, ChArray, Start, 1) = 1, 'AnsiGetNextBufferFromStream failed'); S4 := UCS4ToAnsiChar(ChArray[0]); assert(S1 = S4, 'S1 <> S4'); finally BytesStream.Free; end; end; | ||||
Tags | No tags attached. | ||||
Fixed in GIT commit | ed6f57c303499628c6b43369de6186b21eb57dce | ||||
Fixed in SVN revision | |||||
IDE version | All | ||||
|
We have finally got application running on a new version of this is giving us some problems. I have gone through the code and found the following line in JclStringConversions is what is causing the problem (line 2649) UTF16Buffer := WideString(AnsiString(Chr(B))); And the following seems to fix it UTF16Buffer := WideString(AnsiString(AnsiChar(B))); |
|
Already fixed in git main branch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-21 17:21 | markjonesnz | New Issue | |
2022-06-01 04:55 | markjonesnz | Note Added: 0022031 | |
2023-11-11 23:49 | AHUser | Assigned To | => AHUser |
2023-11-11 23:49 | AHUser | Status | new => resolved |
2023-11-11 23:49 | AHUser | Resolution | open => fixed |
2023-11-11 23:49 | AHUser | Fixed in Version | => Version 2.5 (Subversion repository/Daily zips) |
2023-11-11 23:49 | AHUser | Fixed in GIT commit | => ed6f57c303499628c6b43369de6186b21eb57dce |
2023-11-11 23:49 | AHUser | Note Added: 0022061 |