egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Bot can saved TXT with UTF-8 encoding?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun May 08, 2016 2:48 am    Post subject: [SOLVED] Bot can saved TXT with UTF-8 encoding? Reply with quote

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 Smile


Last edited by juanamores on Thu May 12, 2016 6:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun May 08, 2016 8:13 am    Post subject: Reply with quote

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
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun May 08, 2016 6:22 pm    Post subject: Reply with quote

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..... Confused
_________________
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 Smile
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Thu May 12, 2016 1:05 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber