Sign in to follow this  
Followers 0
nf67

FileWrite() & Special characters?

3 posts in this topic

#1 ·  Posted (edited)

Hi there,

I was wondering if it's possible to put special characters into some kind of text file (.rtf .txt .doc , any text format would be fine).

The script below demonstrates my problem:

$String = ChrW(8592)
MsgBox(0,"Character:", $String) ;Shows the character
FileWrite(@ScriptDir & "\File.txt", $String)
ShellExecute(@ScriptDir & "\File.txt") ;Doesn't show the character

I also tried to write into an HTML file and use & # 8 5 9 2 ; which worked fine, but my "formatting" gets lost when viewing it (no linebreaks, no double spaces).

Please note that there is only basic text, nothing fancy.

Thanks :mellow:

Edited by nf67

Share this post


Link to post
Share on other sites



I was wondering if it's possible to put special characters into some kind of text file (.rtf .txt .doc , any text format would be fine).

Take a look to FileOpen function ;-)

$String = ChrW(8592)
$funicode=FileOpen(@ScriptDir & "\File.txt",258) ;pay attention to the 258. You have all the available options in the help
FileWrite($funicode, $String)
FileClose($funicode)
ShellExecute(@ScriptDir & "\File.txt")

Cheers,

sahsanu

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hmm gives me the following result:

â†

Odd :mellow:

Edit: It does seem to work in the example, let me check my code again.

Edit 2: Weird results when viewing in browser, use Right Click encoding options to switch to UTF -solved :-)

Thanks Sahsanu

Edited by nf67

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  
Followers 0