1. Steen Jakobsen
  2. PowerBuilder Beta
  3. Monday, 26 October 2020 14:53 PM UTC

Hi,

It looks like ImportFile()    (text! and csv!)   does not work correctly with UTF8 encoded files.

ALL European characters like ÆØÅ æøå are corrupted.

 

Do I have to specify and encoding argument ?

 

Thanks

//Steen

 

Mark Goldsmith Accepted Answer Pending Moderation
  1. Friday, 30 October 2020 16:47 PM UTC
  2. PowerBuilder Beta
  3. # 1
1
Votes
Undo

Hi Steen,

There was a similar question posted a number of months ago and so I thought I would share it in the event it helps as well.

https://community.appeon.com/index.php/qna/q-a/fileencoding-utf8-file-returns-ansi

Not to repeat all of what was in the numerous replies, but my hope is that Appeon will add the ability to specify on all functions dealing with importing whether or not the file is UTF-8 or UTF-8 with BOM and, better yet, default to assuming a file is UTF-8 even though the BOM is absent versus defaulting to ANSI if the BOM is absent since the former is so much more prevalent today.

Just my thoughts...

Mark

Comment
There are no comments made yet.
Steen Jakobsen Accepted Answer Pending Moderation
  1. Tuesday, 27 October 2020 16:30 PM UTC
  2. PowerBuilder Beta
  3. # 2
1
Votes
Undo

Thanks for your feedback.

it turns out that PB automatically determine the encoding of ascii / utf8 - very cool.

My problem was and incorrect utf8 header where the BOM was missing. Notepad did however recognise it as UTF8 that was the misleading information that got me to believe that PB had an issue - sorry about that!

So PB rocks once again :-)

 

//Steen

Comment
Hi Steen, the "automatic" detection of Ascii / utf8 isn't always working well (not just with powerbuilder), especially when there's no BOM (which is a legal format). Also PB would rock a little bit more if they'd write that stuff down in the help file.

Thanks for sharing though!

regards,

  1. Miguel Leeuwe
  2. Tuesday, 27 October 2020 17:00 PM UTC
There are no comments made yet.
Andrew Barnes Accepted Answer Pending Moderation
  1. Monday, 26 October 2020 18:36 PM UTC
  2. PowerBuilder Beta
  3. # 3
0
Votes
Undo

Miguel's research is surprising given that the PB switched from ASCII strings to Unicode ones several versions back.  You can submit an enhancement request to Appeon.  They may not be able to fulfill it immediately, but if they are aware of it as something that customers are asking for, they may be able to slip it in.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 26 October 2020 15:17 PM UTC
  2. PowerBuilder Beta
  3. # 4
0
Votes
Undo

Regretfully you cannot specify the encoding:

From the help on ImportFile (datawindow): "must be ascii" so i guess only ansi is supported?

 

filename

A string whose value is the name of the file from which you want to copy data. The file must be an ASCII, tab-separated file (TXT) or a comma-separated file (CSV), Extensible Markup Language file (XML), or dBase format 2 or 3 file (DBF). Specify the file's full name. If the optional importtype is not specified, the name must end in the appropriate extension.

If filename is an empty string, or if it is null, ImportFile displays the File Open dialog box and allows the user to select a file. The remaining arguments are ignored.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.