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

Post your questions and help other users.

Moderator: Martin

Post Reply
angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

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

Post by angelatwork » 12 Feb 2014 02:54

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
Best regards,
AngelAtwOrk

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

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

Post by Martin » 12 Feb 2014 17:41

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

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

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

Post by angelatwork » 13 Feb 2014 22:19

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.
Best regards,
AngelAtwOrk

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

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

Post by angelatwork » 13 Feb 2014 23:24

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.
Best regards,
AngelAtwOrk

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

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

Post by Martin » 14 Feb 2014 10:17

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 äöü.

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

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

Post by angelatwork » 14 Feb 2014 14:05

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 Ã¥,ä,ö
Last edited by angelatwork on 14 Feb 2014 14:22, edited 1 time in total.
Best regards,
AngelAtwOrk

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

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

Post by Martin » 14 Feb 2014 14:19

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.
Attachments
bom.txt
(3 Bytes) Downloaded 800 times

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

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

Post by angelatwork » 14 Feb 2014 14:56

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:
Best regards,
AngelAtwOrk

Post Reply