mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2014
Posts: 23
X
x9J3H8x Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: May 2014
Posts: 23
I have found a script adapted for Israeli writing. This allows the user with old coding ANSH to recognize writing with new coding UTF-8 and vice versa (and by this I mean users who use the old mIRC program and users who use the new version of mIRC). So, is this script that I give you in the following link possible to be converted into Greek writing?

Link: http://script.quakenet.org/wiki/How_to_display_ANSI_chars_in_UTF-8_format

Thanks

Last edited by x9J3H8x; 24/05/14 11:16 PM.

x9A3A8x
Joined: May 2014
Posts: 23
X
x9J3H8x Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: May 2014
Posts: 23
*correction: ANSI


x9A3A8x
Joined: Jul 2006
Posts: 4,193
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
At the end of your link, it is said how to convert it to another codepage:
Quote:
This can be used for other languages as well, by following these changes:

1) Find the ANSI code of the first letter in the new language's alpha-bet, e.g. in this example - 224 is the ANSI code of the first letter in the Hebrew alpha-bet - "Alef"

2) Find the ANSI code of the last letter in the new language's alpha-bet, e.g. in this example - 250 is the ANSI code of the last letter in the Hebrew alpha-bet - "Tav"

3) Replace the previously found codes in the regex of the event trigger. This will make the event catch only possible transformable messages, and not all messages.

4) Replace the GDI charset number in the "heb2utf" alias to the new language number.

5) Optional: Change the name of the alias "heb2utf" (and all its references) to "<yourlang>2utf", e.g. "greek2utf".


For 1) & 2), look up the greek block, it ranges from 0370 to 03FF (880 to 1023).
It gives for 3):
Code:
on $*:TEXT:$(/[ $+ $chr(880) $+ - $+ $chr(1023) $+ ]/):#,?: {

For 4), The Gdi charset for greek is 161, so you replace that accordingly and you're done.

The whole thing would be:

Code:
alias greek2utf {
  if ($isid) {
    return $utfdecode($utfencode($1-, 161))
  }
  echo -ag $utfdecode($utfencode($1-, 161))
}
alias saygreek {
  .raw -n PRIVMSG $active : $+ $greek2utf($1-)
  echo -at < $+ $iif($chan, $nick($chan, $me).pnick, $me) $+ > $1-
}

on $*:TEXT:$(/[ $+ $chr(880) $+ - $+ $chr(1023) $+ ]/):#,?: {
  if ($greek2utf($1-) != $1-) {
    var %g $v1
    if ($chan) {
      echo -gt $chan Possible greek translation ( $+ $nick($chan, $nick).pnick $+ ): %g
    }
    elseif ($query($nick)) {
      echo -gt $nick Possible greek translation ( $+ $nick $+ ): %g
    }
  }
}



Last edited by Wims; 25/05/14 12:23 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: May 2014
Posts: 23
X
x9J3H8x Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: May 2014
Posts: 23
Thank you for the help... It works!
Can we hide the ANSI characters in message? (display only utf8 translated characters)


x9A3A8x
Joined: Jul 2006
Posts: 4,193
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
Are you sure it works? Actually I made a mistake for the on text event, the code point that must be used are the one from the old codepage (I used unicode code point), though this part is wrong, the script should be matching for any value > 127 or something.
But this means the on text event shouldn't be working, it won't even trigger.
If you want to replace the message when possible, use for the on text event:
Code:
on $^*:TEXT:$(/[ $+ $chr(127) $+ - $+ $chr(255) $+ ]/):#,?: { 
 if ($greek2utf($1-) != $1-) {
    haltdef
    var %g $v1
    if ($chan) {
      echo -gt $chan Possible greek translation ( $+ $nick($chan, $nick).pnick $+ ): %g
    }
    elseif ($query($nick)) {
      echo -gt $nick Possible greek translation ( $+ $nick $+ ): %g
    }
  }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: May 2014
Posts: 23
X
x9J3H8x Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: May 2014
Posts: 23

Yes it works , thanks again for the fix code


x9A3A8x

Link Copied to Clipboard