View Issue Details

IDProjectCategoryView StatusLast Update
0005313JEDI VCL00 JVCL Componentspublic2010-10-10 18:15
ReporterKiriakosAssigned Tojfudickar 
PrioritynormalSeveritymajorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0005313: JvAppStorage does not work with WideStrings and Delphi 2010
DescriptionThe idea of the recent updates to jvAppIniStorage is to use the Encoding of the IniFile to save unicode strings. The code for writing/reading WideStrings does not work currently and it needs to be aligned to the standard way of saving unicode strings.

I suggest the following changes to JvAppStorage

procedure TJvCustomAppStorage.DoWriteWideString(const Path: string;
  const Value: Widestring);
begin
  {$IFDEF COMPILER12_UP}
  DoWriteString(Path,string(Value));
  {$ELSE}
  DoWriteString(Path,string(UTF8Encode(Value)));
  {$ENDIF COMPILER12_UP}
end;

function TJvCustomAppStorage.DoReadWideString(const Path: string;
  const Default: Widestring): Widestring;
begin
  {$IFDEF COMPILER12_UP}
  Result := ReadString(Path, string(Default));
  {$ELSE}
  Result := UTF8Decode(ReadString(Path, UTF8Encode(Default)));
  {$ENDIF COMPILER12_UP}
end;

The idea is that if say you want to save a Persistent object with both normal string properties, which are now Unicodestrings, and WideString properties you would have to set the IniFile encoding to UTF8, which will now take care of WideStrings. The above changes take care of WideString properties and WideStringLists and no further changes should be required.
TagsNo tags attached.

Activities

jfudickar

2010-09-06 00:34

developer   ~0017650

But what about a AppStorage engine which supports WideStrings (maybe a database engine).
With your code all widestrings are stored encoded, isn't it?

Regards
Jens

Kiriakos

2010-09-06 17:22

reporter   ~0017658

The code I suggests treats in Unicode versions of Delphi WideStrings in the same way it treats strings (aka UnicodeStrings). Remember that both WideStrings and standard strings are Unicode. If something works for standard strings it should be good enough for WideStrings. If it doesn't it needs fixing for standard strings as well.

obones

2010-10-08 16:31

administrator   ~0017831

So what do we do here?

jfudickar

2010-10-10 18:15

developer   ~0017853

Added to svn

Issue History

Date Modified Username Field Change
2010-08-30 05:08 Kiriakos New Issue
2010-09-06 00:34 jfudickar Note Added: 0017650
2010-09-06 00:34 jfudickar Status new => feedback
2010-09-06 17:22 Kiriakos Note Added: 0017658
2010-10-08 16:31 obones Note Added: 0017831
2010-10-10 18:15 jfudickar Note Added: 0017853
2010-10-10 18:15 jfudickar Status feedback => resolved
2010-10-10 18:15 jfudickar Resolution open => fixed
2010-10-10 18:15 jfudickar Assigned To => jfudickar