O$ 10.0 Export to file on windows is unicode

Bruno Del Sol bruno.delsol at bydesign.fr
Thu May 27 05:37:50 UTC 2021


   Hi Paul,

   I have this defaults at lib's startup to avoid this issue

   Do $root.$prefs.$exportbom.$assign(kFalse) ## No BOM for unicode export
   files

   Do $root.$prefs.$exportencoding.$assign(kUniTypeNativeCharacters) ##
   keep platform encoding for export files

   Do $root.$prefs.$importencoding.$assign(kUniTypeNativeCharacters) ##
   keep platform encoding for import files

   When I want to output Windows encoded files on Mac i override the
   default with

   Do $root.$prefs.$exportencoding.$assign(kUniTypeAnsiLatin1) ##
   kUniTypeISO8859_1 will work also

   I assume this encoding should force CR/LF as end of line, as does
   kUniTypeNativeCharacters on Windows.

   It is likely though that when outputing UTF8 files with

   Do $root.$prefs.$exportencoding.$assign(kUniTypeUTF8)

   the end of line character would be platform dependent.

   so if you need to enforce CR/LF you'll have to code exports in a way
   that gives you control over the end of line char (there are several
   options).

   Regards
   Bruno

By Design
[1]http://www.bydesign.fr
Bruno Del Sol
[2]bruno.delsol at bydesign.fr
46, rue de La Tour d'Auvergne
75009 Paris (France)

   Le 27/05/2021 à 03:32, Paul Mulroney a écrit :

Hi $all,

I've got a weird one.  I'm exporting a file to disk, and then later it's being d
ownloaded in the jsClient.  When I'm testing on my mac, it downloads the tab-del
imited file as ASCII UTF-8, no problems. Run the same in production on windows s
erver, and it's downloaded as UTF-8 with BOM.  This causes problems when I try t
o open the file in Excel.  The file also has CR/LF when exporting from a windows
 platform, and only a CR when exporting from the Mac.

Can I make it so that it always exports with CR/LF, regardless of platform?

It's running a multi-threaded server, I'm wondering if that's causing a problem
with the unicode export?

Here's the code in the startup task:


Do $root.$prefs.$exportencoding.$assign(kUniTypeUTF8)
## Export as UTF-8 (ie ASCII)
Do $root.$prefs.$exportbom.$assign(kFalse)
## Turn off export Byte Order Marker in the export file.

Here's the basic code that generates the export file.


Set print or export file name [vsPathName]
Prepare for export to file Delimited (tabs)
Export data vlExport
End export
Close print or export file

What am I missing?

Regards,
Paul.




An invisible man married an invisible woman.  The kids were nothing to look at e
ither.

References

   1. http://www.bydesign.fr/
   2. mailto:bruno.delsol at bydesign.fr


More information about the omnisdev-en mailing list