Sign in to follow this  
Followers 0
Juvigy

Strange symbols when pasting text

8 posts in this topic

Hi Guys ,

I have a small app that copies data from .txt files to external 3rd party app hosted on citrix.

The issue is that sometimes some users when pasting experience character abnormalities:

coma, dash and bulets for example are changed to symbols like : –

How can i avoid that when AutoIt opens the txt file and reads the data ?

I am using FileOpen($filepath,0) and FileRead($file) then clipput , clipget and Send("^v")

Share this post


Link to post
Share on other sites



Might be a character encoding problem. Have you tried changing the mode of FileOpen?

Share this post


Link to post
Share on other sites

Might be a character encoding problem. Have you tried changing the mode of FileOpen?

Change it to what? I havent tried it as testing is difficult - i dont have access to the PCs that have the issues.

It may be due to the fact that there are different language and locations settings - russion, german ,spanish etc.

How can i be independant of the encoding ?

Share this post


Link to post
Share on other sites

Smells like UTF-8 text to me.

AutoIt uses UTF-16 (more precisely UCS-2). Use the relevant function to convert to/from:

Func __UTF16toUTF8($sUTF16)
Return(BinaryToString(StringToBinary($sUTF16, 4)))
EndFunc
Func __UTF8toUTF16($sUTF8)
Return(BinaryToString(StringToBinary($sUTF8), 4))
EndFunc

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)

Share this post


Link to post
Share on other sites

I didn't knew that there was such an issue..... should we always do this conversion from UTF16 to UTF8 ?


[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

Only when interfacing to/from external application demanding UTF-8.


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)

Share this post


Link to post
Share on other sites

Only when interfacing to/from external application demanding UTF-8.

Thank you jchd...


[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

Thanks Jchd i will try it out.

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