| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun May 08, 2016 2:48 am Post subject: [SOLVED] Bot can saved TXT with UTF-8 encoding? |
|
|
I use:
| Code: | set liveme [encoding convertfrom utf-8 "[lrange $cursong 1 [llength $cursong]]"]
set temp [open "livesong.txt" w+]
puts $temp "$liveme"
close $temp |
But, the livesong.txt file is saved with ANSI encoding.
I need the BoT save it with UTF-8 encoding.
It can? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks 
Last edited by juanamores on Thu May 12, 2016 6:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun May 08, 2016 8:13 am Post subject: |
|
|
You could use the fconfigure command to set the desired encoding of the channelId (in this case, the opened file).
Try something like this:
| Code: | set liveme [encoding convertfrom utf-8 "[lrange $cursong 1 [llength $cursong]]"]
set temp [open "livesong.txt" w+]
fconfigure $temp -encoding utf-8
puts $temp "$liveme"
close $temp |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun May 08, 2016 6:22 pm Post subject: |
|
|
Thanks nml375 , works!
EDIT
Not work
| Code: | [juan@vps92318 eggdrop]$ file -bi livesong.txt
text/plain; charset=us-ascii |
I try
| Code: | [juan@vps92318 eggdrop]$ iconv -f us-ascii -t UTF-8 livesong.txt
[juan@vps92318 eggdrop]$ file -bi livesong.txt
text/plain; charset=us-ascii |
The Bot does NOT save the file with UTF-8 encoding format and the system did not change the encoding.....  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Thu May 12, 2016 1:05 am Post subject: |
|
|
I edited the post , encoding not work.
Final Edit:
I fixed it!!
Instead of utf-8 the encoding was iso-8859, because my web client works with Windows system. _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
|