Thread: bugfix: Encoding of config files

bugfix: Encoding of config files

From
"Magnus Hagander"
Date:
Hi!


Seems the config files are read as ASCII but written as UTF8. I don't
think you'd normally see non-ascii characters in the values, but I
definitly have them in the comments somewhere. And things should at
least be consistent.

Attached patch reads the file as UTF8, and doesn't change the writing.

//Magnus

Attachment

Re: bugfix: Encoding of config files

From
"Dave Page"
Date:
Thanks, patch applied to 1.4.x and 1.6.

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Magnus Hagander
> Sent: 23 January 2006 11:33
> To: pgadmin-hackers@postgresql.org
> Subject: [pgadmin-hackers] bugfix: Encoding of config files
>
> Hi!
>
>
> Seems the config files are read as ASCII but written as UTF8. I don't
> think you'd normally see non-ascii characters in the values, but I
> definitly have them in the comments somewhere. And things should at
> least be consistent.
>
> Attached patch reads the file as UTF8, and doesn't change the writing.
>
> //Magnus
>

Re: bugfix: Encoding of config files

From
Andreas Pflug
Date:
Dave Page wrote:

>Thanks, patch applied to 1.4.x and 1.6.
>
>

Hm, this certainly should be consistent, but I'd guess most files will
use a 1-byte system charset, not UTF8, thus wxConvLibc not wxConvUTF8 is
the right one.

Regards,
Andreas


Re: bugfix: Encoding of config files

From
"Magnus Hagander"
Date:
> >Thanks, patch applied to 1.4.x and 1.6.
> >
> >
>
> Hm, this certainly should be consistent, but I'd guess most
> files will use a 1-byte system charset, not UTF8, thus
> wxConvLibc not wxConvUTF8 is the right one.

I for one certainly bow to that one. As said before, the encodings
dealings is defintily not my strong side :-)

//Magnus

Re: bugfix: Encoding of config files

From
Andreas Pflug
Date:
Magnus Hagander wrote:

>>>Thanks, patch applied to 1.4.x and 1.6.
>>>
>>>
>>>
>>>
>>Hm, this certainly should be consistent, but I'd guess most
>>files will use a 1-byte system charset, not UTF8, thus
>>wxConvLibc not wxConvUTF8 is the right one.
>>
>>
>
>I for one certainly bow to that one. As said before, the encodings
>dealings is defintily not my strong side :-)
>
>

Well, itsapita. Nobody likes to deal with it voluntarily... :-)

Regards,
Andreas


Re: bugfix: Encoding of config files

From
Dave Page
Date:


On 23/1/06 18:53, "Magnus Hagander" <mha@sollentuna.net> wrote:

>>> Thanks, patch applied to 1.4.x and 1.6.
>>>
>>>
>>
>> Hm, this certainly should be consistent, but I'd guess most
>> files will use a 1-byte system charset, not UTF8, thus
>> wxConvLibc not wxConvUTF8 is the right one.
>
> I for one certainly bow to that one. As said before, the encodings
> dealings is defintily not my strong side :-)

Ditto. Will commit the change.

/D


Re: bugfix: Encoding of config files

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 23 January 2006 23:31
> To: Dave Page
> Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] bugfix: Encoding of config files
>
>
> NB, when reading AND writing!
> And the wxUtfFile class will behave differently when creating
> a file or
> rewriting (will preserve encoding in the latter case)

Err, ok. Well, how does the attached look o'Guru of encoding and such
things?

Regards, Dave.

Attachment

Re: bugfix: Encoding of config files

From
Andreas Pflug
Date:
Dave Page wrote:
>
>
>
>>-----Original Message-----
>>From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
>>Sent: 23 January 2006 23:31
>>To: Dave Page
>>Cc: Magnus Hagander; pgadmin-hackers@postgresql.org
>>Subject: Re: [pgadmin-hackers] bugfix: Encoding of config files
>>
>>
>>NB, when reading AND writing!
>>And the wxUtfFile class will behave differently when creating
>>a file or
>>rewriting (will preserve encoding in the latter case)
>
>
> Err, ok. Well, how does the attached look o'Guru of encoding and such
> things?

No need to detect encoding, file reading/writing committed.

This problem probably persisted before, but problematically the problem
that when opening a file after a file was opened (just open a file, and
then open a recent file) is still persistent as problem. Probably a
not-so-clean destructor (line array?)

Regards,
Andreas

Re: bugfix: Encoding of config files

From
Dave Page
Date:


On 24/1/06 19:07, "Andreas Pflug" <pgadmin@pse-consulting.de> wrote:


> No need to detect encoding, file reading/writing committed.
>
> This problem probably persisted before, but problematically the problem
> that when opening a file after a file was opened (just open a file, and
> then open a recent file) is still persistent as problem. Probably a
> not-so-clean destructor (line array?)

Wow, that was a real purple monkey dishwasher moment!! :-)

Thanks for fixing.

/D