sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #12588
Re: [Question #201882]: Replace chars in a var - string is UTF-8 encoded
Question #201882 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/201882
Status: Open => Answered
RaiMan proposed the following answer:
If it is Notepad++ and it talks about ANSI, then it is definitely not
utf-8, but something like the Windows standard encodings like
Windows-1252 or ISO Latin-1
--- encode/decode("string_escape")
is only a feature that internally allows to convert every byte string into a string that physically contains these 4 characters for every byte: \xHH, where H is one out the hexa digits 0 .. f.
It is a poor man's solution to encode a byte stream, so that it can be
transported on every ascii-only channel (like the more efficient
Base64), but does not do any conversion/interpretation.
So lets assume it is latin-1:
fullName = Env.getClipboard().decode("latin_1") # gets it into full
name correctly
print fullName.encode("utf8") # prints it correctly to the message area
print fullName.split(" ") # splits it into its contents
paste(fullName.split(" ")[0]) # pastes it correctly to a latin-1 aware
environment
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.