Jump to content

FileWrite() & Special characters?


Recommended Posts

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
Link to comment
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

Link to comment
Share on other sites

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
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...