#1615 set charset

motonao Sat 13 Aug 2011

I would like to know how to change charset of echo() fanction . My environment is Win7 and charset of the console is Japanese SHIFT-JIS. So I need to change charset to show Japanese characters.

brian Sat 13 Aug 2011

You should be able to configure it as follows:

Env.cur.out.charset = Charset("Shift-JIS")

motonao Tue 16 Aug 2011

Thanks for the reply. It works fine.

motonao Sun 4 Sep 2011

I would like to ask a little different question.

I can't get Japanese command line args in Windows .

class MyTest {

static Void main() {
    Env.cur.out.charset = Charset("Shift_JIS")
    echo("arg=${Env.cur.args[0]}")
}

}

>fan mytest.fan "<shift-jis-characters>"

args=??

It shows garbled or sometimes disappear, depends on characters. How can I get args ?

brian Sun 4 Sep 2011

Try using the Java command line without the fan.exe wrapper and see if that works:

// via env var
C:\>set fan_home=c:\dev\fan
C:\>java -cp %fan_home%\lib\java\sys.jar fanx.tools.Fan -version

// via system property
C:\>java -cp c:\dev\fan\lib\java\sys.jar -Dfan.home=%fan_home% fanx.tools.Fan -version

motonao Mon 5 Sep 2011

Thanks for the answers. I made a .bat file and got command line arguments.

Login or Signup to reply.