Page 1 of 1

write to file, implement File Code 65001:unicode UTF-8)

Posted: 12 Feb 2014 02:54
by angelatwork
Hi, great app!
I have managed to automate some bits and pieces concerning time reporting (for example, when a meeting (sceduled in your calendar) is finished, a question pops up and asks if it was a job meeting. If so, the flow opens a time sheet app where you can import the meeting into the time sheet.

Now to my question; I am trying to write to file with Automagic, which later can be opened directly in Excel without going through the text import guide.

I live in Sweden and our computers are localized accordingly. So for Excel to open and show a csv file correctly, the file needs to have a ";" semicolon as delimiter, instead of a comma. That is no problem with automagic, you just exchange the commas to semicolons in your text in "write to file" action.

But we also use å,ä,ö in our language so I need to let excel know which code to use. When I go through the text import guide in excel with events from google calendar written to a file, a format that will open the text correctly and not make part of the text to gibberish is 65001: Unicode (UTF-8).

Is there anyway to do this (give instructions for excel in the txt/csv/skv/prn file itself) already when writing to file in the android?

Would be really greatful if there is a solution

Angel

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 12 Feb 2014 17:41
by Martin
Hi,

Thanks :-)

I think Excel correctly imports the file when the file starts with an UTF-8 BOM. It's probably not possible to add the BOM with Automagic at the moment.
As a workaround you could create an empty file that just contains the BOM, copy this file to your Android device then use an action Copy File to use this file as a starting point before Automagic appends the first row of CSV data.

Regards,
Martin

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 13 Feb 2014 22:19
by angelatwork
Thanks for the swift reply,

I will try to try :D

I did think that the BOM probably was important ( after googling). Now I just have to figure out how to put BOM in a file. Is it just those characters that Wiki mentions?

Or are you saying that if I create and name an empty file in my localized Excel on my PC and save it as csv (or even xls), it will automatically have the BOM included? And then just copy it into my s3 and then save/append my text to that file? Should the action copy file (the empty one) be in the flow before write to file, or is it just the first time it is needed? If it should be copied everytime, can I later copy the file, which now already has stored informations so the new info gets appended?

I have a tendency to try to run, before I can walk :lol: , but if one is stubborn enough, it takes you a long way! and with your automagic it is absolutely easier!

I am trying to automate most "boring" administrative things for my husband to make life easier for him, and thanks to Automagic I think I have managed some of them already and I have only had Automagic for less than a week.

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 13 Feb 2014 23:24
by angelatwork
Appending the following to my answer;

Does my problem have anything to do with Automagic not being localized in Swedish?

(That is fine with me, because what you gain in understanding, you loose risking to misinterpret what commands and so on others are writing/talking about due to translation.)

The text I try to write to file with å, ä,ö is naturally written and shown correctly in my localized Google Calendar, but not after it has passed through Automagic.
And this is consistent with the fact that;
using the Overlay Option in Control UI and copy a command to clipboard. I cannot just paste the copied command into a script. The pasted command needs editing since the characters å, ä, ö will become a string of 4? characters or so each.

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 14 Feb 2014 10:17
by Martin
No, it should not be a problem that Automagic is not available in Swedish. Java Android apps internally use unicode (UTF-16) to store texts so special characters like å, ä, ö should not be mangled.

Attached text file contains an UTF-8 BOM. You can try to use this file as a base then append text to the file and check if Excel can properly import this file. I have currently no Excel available to test this myself.

Ahh, I can see what you mean in the Control UI action. That's a bug :)
Automagic should not show the characters as \u00E5\u00E4 etc. but should show the characters as äöü.

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 14 Feb 2014 14:05
by angelatwork
Attached? have you attached a textfile? I feel lika an idiot, but where can I find it, if that is what you mean? :?

I am trying to look at the different files in notepad++, but it does not make me much wiser. Under encoding UTF-8 without bom is ticked when I open the created file. When I open the same file in Excel å,ä,ö shows up like Ã¥,ä,ö

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 14 Feb 2014 14:19
by Martin
No, sorry, I'm the idiot :D forgot to attach the file.
I hope that the forum software does not modify the contents of the file for some reason. The file should have a size of 3 bytes when downloaded.

Re: write to file, implement File Code 65001:unicode UTF-8)

Posted: 14 Feb 2014 14:56
by angelatwork
It worked :D ! Thank you sooo much!

And I only need to "copy file" once. And I also think I figured out how to use Notepad++ in these instances. I could not make it work by changing the encoding of an existing file, but I can create a file with the right encoding and use it as a file to start with.

Love ya :lol: