| View previous topic :: View next topic |
| Author |
Message |
Keen Voice
Joined: 28 Jan 2009 Posts: 10
|
Posted: Thu Mar 15, 2012 10:32 pm Post subject: Bogus trivia non-english users answer problem. |
|
|
Hello many of my users come from english speaking countries. So bogus trivia must accept both non-english and english char answers.
For example if the answer of the question is "Şeytan" the english speaking users cant type Şeytan they have to write seytan/Seytan because there is no turkish chars in ther computer. But the bogus trivia bot does not accept this answer. can we make it with a code such this?
| Quote: |
regsub -all {ğ} $tx "g" tx
regsub -all {Ğ} $tx "G" tx
regsub -all {ü} $tx "u" tx
regsub -all {Ü} $tx "U" tx
regsub -all {ş} $tx "s" tx
regsub -all {Ş} $tx "S" tx
regsub -all {ı} $tx "i" tx
regsub -all {İ} $tx "I" tx
regsub -all {ö} $tx "o" tx
regsub -all {Ö} $tx "O" tx
regsub -all {ç} $tx "c" tx
regsub -all {Ç} $tx "C" tx
|
i want bot accept both Ç and C hars but i dont know how to do. thank you. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Mar 16, 2012 1:30 am Post subject: |
|
|
You should use Johannes13's two function to encode and decode a text to and from Turkish to English instead of the regsubs.
| Code: |
proc enc v {
subst [regsub -all {[^a-zA-Z0-9\-_\.~]} [encoding convertto utf-8 $v] {[format %%%02X [scan {\0} %c]]}]
}
proc decode v {
encoding convertfrom utf-8 [subst -nocommands -novariables [regsub -all {%([a-fA-F0-9]{2})} $v {\u\1}]]
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Keen Voice
Joined: 28 Jan 2009 Posts: 10
|
Posted: Fri Mar 16, 2012 12:48 pm Post subject: |
|
|
| thank you caesar but im new in tcl. Can you implement this code for me to the bogus tcl? Thank you. |
|
| Back to top |
|
 |
kingkong Voice
Joined: 08 Apr 2012 Posts: 10
|
Posted: Sun Apr 08, 2012 5:19 am Post subject: |
|
|
According to your words, I assume that your bot can accept Turkish chars. So, You don't need to recode or edit anything in tcl.
All you need to do is just to put both of answers in your question file. seperate the answers with * sign. just edit your answers in such questions as like that and bot will accept both(answer can be more than one or two) of the answers;
question*answer1*answer2
in your case;
question*Seytan*Şeytan
so, nothing else will need to do. |
|
| Back to top |
|
 |
|