mIRC Homepage
Posted By: NineTails SJIS/JIS - 11/05/06 12:39 PM
I don't know if it's a proper section to write in, but..

We all know there's an issue with SJIS/JIS conversion in mIRC. Particularry, when you have SJIS/JIS enabled AND you have at least one channel with Japanese encoding, you won't be able to post certain words on channels which have +c mode. Obviously, the problem is in that SJIS/JIS conversion which does not check if the text is japanese.

So, unless we have SJIS/JIS conversion in Font dialog, I'd like to make $sjis and $jis snippets to see and send the text properly. Anyone knows how this conversion is being made?
Posted By: NineTails Re: SJIS/JIS - 11/05/06 06:38 PM
Woo Hoo, I made jis -> sjis conversion trigger. Here it is, with all debug info and useless echoes:
Code:
 on 1:TEXT:*:*: {
  var %converted1
  var %converted
  var %x = 1
  var %j1
  var %j2
  var %s1
  var %s2
  var %jis
  var %findjis = /\$B(.+)\(B/Sig

  while ( %x <= $len($1-) ) {
    set %jis %jis $asc( $mid( $1-, %x, 1 ))
    set %x %x + 1
  }

  echo 12 -ta < $+ $nick $+ > %jis
  echo 13 -ta < $+ $nick $+ > $alw($1-)
  echo 14 -ta --------------------------
}

alias alw {
  var %x = /\$B(.+?)\(B/g 
  return $regsubex($1-,%x, $convert(\t) )
}

alias convert {
  echo -a raw symbol is: $1-
  var %x = 1
  var %y
  var %z
  var %j1
  var %j2
  var %s1
  var %s2
  while ( %x < $len($1-) ) {
    set %j1 $asc( $mid( $1-, %x, 1 ) )
    set %j2 $asc( $mid( $1-, $calc( %x + 1 ), 1 ) )
    echo -a $mid( $1-, %x, 1 ) $mid( $1-, $calc( %x + 1 ), 1 ) --- %j1 %j2
    if ( ( 33 <= %j1 ) && ( %j1 <= 96 ) ) {
      set %s1 $calc( $int( $calc( ( %j1 + 1 ) / 2)) + 112 )
    }
    if ( ( 97 <= %j1 ) && ( %j1 <= 126 ) ) {
      set %s1 $calc( $int( $calc( ( %j1 + 1 ) / 2 )) + 176 )
    }
    if ( $calc( %j1 % 2 ) == 1 ) {
      set %s2 $calc( %j2 + 31 + $int( $calc( %j2 / 96 ) ) )
    }
    else {
      set %s2 $calc( %j2 + 126 )
    }
    echo -a ss's: %s1 %s2
    set %x $calc( %x + 2 )
    set %z %z $+ $chr( %s1 ) $+ $chr( %s2 )
  }
  return %z
}

Ansi processing must be turned off.
© mIRC Discussion Forums