Jump to content

How to FileWriteLine() Chinese characters?

Go to solution Solved by Myicq,

Recommended Posts

First, the value of my $LineArray[0] is "歌词制作 生态。破坏"..

And whenever I tried to run this code:

FileWriteLine($PathName, $LineArray[0] & @CRLF)

The line of the created file produced the "???? ?????" null characters..

Now, what can I do to make it write the original (I think) Chinese characters?

Edited by Servant
Link to comment
Share on other sites


it does work as expected...

$filename = @ScriptDir & "\chinesestring"
$string = "北京市 - 邓小平"    ; Beijing - Deng Xiaoping
$f = FileOpen($filename & "_unicode_.txt", 2+64)    ; unicode
$f2 = FileOpen($filename & "_utf8BOM_.txt", 2+128)    ; utf8 with BOM
$f3 = FileOpen($filename & "_utf8plain_.txt", 2+256)    ; utf8 no BOM
FileWriteLine($f, $string)
FileWriteLine($f2, $string)
FileWriteLine($f3, $string)



Result are 3 files as attached.




I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...