Jump to content
Sign in to follow this  
redcrusher

getting / writing asian characters [Solved]

Recommended Posts

redcrusher

For some reason, when i get the title of a webpage that has asian characters in it, it writes "???????" for those characters.

Does anyone know the reson why?

$title = WinGetTitle("[active]")
FileWriteLine($file,$title)
Edited by redcrusher

Share this post


Link to post
Share on other sites
Paperfeed

You have to open a file with the Unicode flag.

Try this:

$hFile = FileOpen(@ScriptDir & "\TEST.txt", 129) ; UTF-8 Unicode Writing Mode (128 for UTF-8 + 1 for Writing mode = 129)
$sTitle = "テスト タイトル - 日本語"
FileWriteLine($hFile, $sTitle)
FileClose($hFile)

Don't forget that you have to make sure your editor (atleast with Scite) is set to the proper encoding as well (UTF-8 with BOM should do) or it won't compile.

Share this post


Link to post
Share on other sites
redcrusher

You have to open a file with the Unicode flag.

Try this:

$hFile = FileOpen(@ScriptDir & "\TEST.txt", 129) ; UTF-8 Unicode Writing Mode (128 for UTF-8 + 1 for Writing mode = 129)
$sTitle = "テスト タイトル - 日本語"
FileWriteLine($hFile, $sTitle)
FileClose($hFile)

Don't forget that you have to make sure your editor (atleast with Scite) is set to the proper encoding as well (UTF-8 with BOM should do) or it won't compile.

PERFECT! ;)

thank you

Share this post


Link to post
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
Sign in to follow this  

×