Jump to content

Filewrite changing characters


Recommended Posts

Hi,

I have an Autoit script which takes a text from the clipboard and writes it to a text file.  

However, it changes characters in the text for some reason - for example all the dashes in the text get converted to â€“

Not sure what I am doing wrong.

This is the code: 

     $hFilehandle = FileOpen("c:\emr\dragon.txt", 2)
            FileWrite($hFilehandle, clipget())
         FileClose($hFilehandle)
 

Would appreciate any input

Kris

 

Link to post
Share on other sites
28 minutes ago, KDoc said:

This is the code: 

     $hFilehandle = FileOpen("c:\emr\dragon.txt", 2)

You may have to set a different parameter for the mode, see : FileOpen

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

The help for FileOpen says:

Quote

The default mode when writing text is UTF8 (without BOM)

So what you call your "dashes" (probably some Unicode character among ‐‑‒–—― respectively 0x2010 HYPHEN, 0x2011 NON-BREAKING HYPHEN, 0x2012 FIGURE DASH, 0x2013 EN DASH, 0x2014 EM DASH or even 0x2015 HORIZONTAL BAR) get encoded as UTF8.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...