UTF-7 conversion?

I am still struggling with the conversion of a macOS Desktop app to Windows. Most is fine now, but the app can import CSV files created by WooCommerce and a first test failed brilliantly. It seems that WooCommerce outputs UTF-7-encoded CSVs instead of UTF-8 on macOS.
While I try to have the client test different export settings: Is there any UTF-7 conversion routine out there?

Totally perverted but works fine:

[code]'test with dim temp as string = “sm&-&APY-rebr&APY-d+t&AOQ-st”

dim theCommand as String = “php -r ““echo mb_convert_encoding(’” + theString + “’, ‘UTF-7’, ‘UTF-8’);”””
dim theShell as new Shell
theShell.Execute theCommand

if theShell.ErrorCode = 0 then
theString = theShell.Result
else
Return “”
end if[/code]

And tell WooCommerce that they need to fix this. I’ve never seen UTF-7 except when doing raw Imap.

Thanks a lot for the fast reply!
Sadly, it does not work for me. Maybe I was wrong with assuming UTF-7?

The CSV content looks like

and the shell result is

It’s been too long since I puttered around with this odd format. There were different variations of the format. Hmmm… the test fails for me, too. The result of the test should be something like “smörebröd” AFAIR. Okay, code is too old.

There is a conversion table at http://string-functions.com/encodingtable.aspx?encoding=65000&decoding=65001

+ACI is a ". But what is the part with +//0Aw//9ALw- ? From the text it should be an ü but this is +APw- . You may want to ask WooCommerce what this is.

I have a bunch of friends at BigCommerce if you’re looking for alternatives :slight_smile:

[quote=364845:@Ulrich Bogun]Thanks a lot for the fast reply!
Sadly, it does not work for me. Maybe I was wrong with assuming UTF-7?[/quote]

A little while ago, I was tackling something similiar where I could not rely on the encoding of the file I was reading to always be UTF-8.

The following thread helped me understand how Xojo reads Byte-Order-Marks (BOM) of a file to determine the encoding New Framework - TextEncoding from Byte Order Mark

The UTF-7 BOM markers are listed here

Then, once you have the encoding determined, you can use Xojo.IO.TextInputStream.Open to read the file in it’s original format as a “Text” datatype, with the original characters represented properly.

I hope that I’m understanding the problem correctly and that this helps. Good luck!