LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to input non-utf characters from utf-8 linux enviroment? (http://www.linuxquestions.org/questions/linux-general-1/how-to-input-non-utf-characters-from-utf-8-linux-enviroment-702683/)

jadas 02-06-2009 04:24 AM

How to input non-utf characters from utf-8 linux enviroment?
 
Recently I tried to open a password protected pdf under Mandriva linux, but even though I knew the password it didn't work. In Windows worked just fine. So, I came to the conclusion that the password was created under windows which uses iso-8859-* or windows-125*(the password uses local characters not latin), and adobe reader can't properly convert utf-8 characters from my keyboard so I can open the pdf.
Is there any way to input iso-8859-* or windows-125* only to adobe reader without changing my whole system's encoding?

Thanks in advance,
Jadas

jschiwal 02-06-2009 04:41 AM

A) You might try starting acroread in konsole after changing the encoding of the terminal.

B)
Code:

iconv -f UTF-8 -t UTF-16 <(echo 'abc#$%%^')
��abc#$%%^
jschiwal@qosmio:~/547968> iconv -f UTF-8 -t UTF-16 <(echo 'abc#$%%^') >tempfile
jschiwal@qosmio:~/547968> file tempfile
tempfile: Little-endian UTF-16 Unicode character data, with no line terminators

You could echo the password through iconv and then copy & paste it into the dialog.

C) Try both.

I'm not sure which LC_ variable it would be but you can precede a command, setting a variable, as in "LC_LANG=en_US acroread /path/to/file.pdf". Also, the acroread command is a bash wrapper for the real command. There are a number of locale variables used in the script, so I'm sure that acroread uses them. I didn't see anything trying "acroread -help".

If a character doesn't translate from one encoding to another, iconv can't convert the text, however if y ou change the encoding of the terminal, and then echo it, I think if you cut and paste the characters echoed, the byte by byte values may be the same.

jadas 02-06-2009 07:13 AM

Thanks for the answer but nothing worked. I changed konsole's encoding but I couldn't echo non latin characters. The other methods just start adobe reader but don't accept the password

jschiwal 02-06-2009 07:29 AM

What kind of characters where used in the password. Any accented characters. You can add a keyboard layout. For example, add another US layout, and select "alt-int" variant, and then change the label (usi for example).

Which encoding was used for the password. (e.g. ISO_8859-1)

I don't work with encodings much. There may be xorg settings that would do it.

jadas 02-06-2009 04:21 PM

Changing layouts didn't help. Password is encoded in iso-8859-7.

jschiwal 02-07-2009 04:55 AM

I looked at "localedef --list-archive" and the only iso8859-7 values listed where el_CY.iso88597 and el_GR.iso88597.

Try "LANG='el_CY.iso8859-7' LC_ALL='el_CY.iso8859-7' LC_CTYPE='el_CY.iso8859-7'

You might need to change your language, locale and keyboard settings. Perhaps you could create a new user and select that language when you log in as the new user.

jadas 02-07-2009 03:20 PM

That command worked! Thanks.


All times are GMT -5. The time now is 03:09 AM.