Page 1 of 1

read file8

Posted: 23 Jun 2023 6:59
by drspro2
dear,

I open a file marked as ANSI in notepad-plus and i read in Vip with:

inputstream_file::openFile8( dataFile52 ),

but still i do not have the special characters in the program , characters like : é

( i hope e accent displays in the forum )

Re: read file8

Posted: 23 Jun 2023 9:31
by drspro2
in another machine it works correct

Re: read file8

Posted: 23 Jun 2023 9:37
by Thomas Linder Puls
"ANSI" does not really make sense for the letter é. Because "ANSI" is not a specific character set.
People often use it for "their" 8 bit character set. I don't know it means in notepad++.

openfile8 uses threadAnsi:

Code: Select all

clauses     openFile8(Filename) :-         openFile(Filename, ansi(threadAnsi)).
You could be one of the persons that have "received" utf8 as their "threadAnsi" codepage (I have not figured out who has that and why). In any case it seems that you threadAnsi codepage is not the one used to encode the file.

My guess it that it is codepageId::codePage_windows1252, and that you will therefore receive the correct contents if you use:

Code: Select all

    ... = openFile(dataFile52, ansi(codepageId::codePage_windows1252))

Re: read file8

Posted: 23 Jun 2023 9:40
by Thomas Linder Puls
Next version of Visual Prolog (i.e. 11) will deprecate threadAnsi and you will need to be more precise when dealing with text files.

Re: read file8

Posted: 25 Jun 2023 21:44
by drspro2
thankyou for the information