This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Swedish characters

Old posts that have not been replied to for several years.
Locked
V
ViU

Swedish characters

Post by ViU »

I have a simple script:

Code: Select all

bind pub - !kaffe kaffe

proc kaffe {nick host hand chan text} {
if {$text == "mjölk"} {
               putserv "PRIVMSG $chan :\001ACTION hämtar en kopp kaffe med mjölk åt $nick"
  }
}
It works if I try to match it against something without scandinavian characters. But if I try to match it against scandinavian it doesent react, I'd guess that its because somewhere the scandinavian characters in $test gets translated into some code, and thats why it wont match.

Anybody have any idea on how to solve this?
n
netux
Voice
Posts: 19
Joined: Fri Jul 30, 2004 8:42 pm

Post by netux »

i think you need to split text firsts but i'm not shure just try it

Code: Select all

bind pub - !kaffe kaffe 

proc kaffe {nick host hand chan text} { 
set stext [split $text]
if {$stext == "mjölk"} { 
               putserv "PRIVMSG $chan :\001ACTION hämtar en kopp kaffe med mjölk åt $nick" 
  } 
} 
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Noticed something that might need fixing.

Code: Select all

putserv "PRIVMSG $chan :\001ACTION hämtar en kopp kaffe med mjölk åt $nick\001" 
Shell character settings affect how the bot "sees" and displays special characters.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Take a look at this post. :wink:

*ASCII Codes*

You might need to convert them into hexadecimals first and then try to match them. :P

Plus, try using 'string match', or 'string equal' that is more appropriate than using the '==' comparator. :mrgreen:

Something like this should do it:

Code: Select all

if {([string equal "mjölk" $text])} {

or

if {([string equal "mj\xF6lk" $text])} {
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

if Alchera's fix didnt work, try using 'encoding'

Code: Select all

set bleh [encoding convertfrom identity $bleh]
... you get the idea..
Locked