Problem with Put

Discuss RoboTask here

Problem with Put

Postby dougmacg » Wed Jan 01, 2020 4:24 pm

I am a relative newbie. I use Put Text to read a txt file with UTF-8 encoding that contains "4641919360236" then I do Paste into text box in a browser. What appears "㘴ㄴㄹ㌹〶㌲" It appears to be an encoding issue but I can't figure out what to do. Any help greatly appreciated!
dougmacg
 
Posts: 4
Joined: Wed Jan 01, 2020 5:29 am

Re: Problem with Put

Postby Oleg » Thu Jan 02, 2020 10:50 am

In seems you are using {TextFileUNICODE(file_name)} variable instead of {TextFileUTF8(file_name)}
If you read the text as Unicode text you get the same string as you.

Try my example please (see below)
The task reads the simple text file with one line: "4641919360236"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1495382924
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task162"
Hide=INTEGER|0
ID=INTEGER|-996368743
LogOnAsUser=INTEGER|1
Name=STRING|"Test unicode text"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""ASUTF8"" with value ""{TextFileUTF8(D:\Temp\utf8text.txt)}"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varname=STRING|"ASUTF8"
varvalue=STRING|"{TextFileUTF8(D:\Temp\utf8text.txt)}"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""ASUNICODE"" with value ""{TextFileUnicode(D:\Temp\utf8text.txt)}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"ASUNICODE"
varvalue=STRING|"{TextFileUnicode(D:\Temp\utf8text.txt)}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""As unicode : {AsUnicode}"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"As unicode : {AsUnicode}"
msg1=STRING|"As UTF8: {AsUTF8}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

Oleg Yershov
Oleg
Site Admin
 
Posts: 2596
Joined: Thu Jan 01, 1970 1:00 am

Re: Problem with Put

Postby dougmacg » Thu Jan 02, 2020 6:22 pm

Thanks for your response. I don't what I am doing wrong. When I save your example and import, I do not see the complete task imported. I will upload a screenshot of what I see.
Attachments
robotaskexampleimported.PNG
robotaskexampleimported.PNG (20.57 KiB) Viewed 3936 times
dougmacg
 
Posts: 4
Joined: Wed Jan 01, 2020 5:29 am

Re: Problem with Put

Postby dougmacg » Thu Jan 02, 2020 9:03 pm

I see now that what I imported is what is intended. I was thrown off by the other lines in the code window.
dougmacg
 
Posts: 4
Joined: Wed Jan 01, 2020 5:29 am

Re: Problem with Put

Postby dougmacg » Thu Jan 02, 2020 10:38 pm

Problem solved. Thanks for your help.
dougmacg
 
Posts: 4
Joined: Wed Jan 01, 2020 5:29 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 24 guests

cron