I know this is a quite common issue, but after reading some of the forum threads, read some articles, still haven't found a solution , and i'm quite sure it's a simple one. The problem is that i have a code with some hebrew letters that are inserted by the user (raw_input). as long as I ask to print what the user typed it's ok. once i get it into a list it gives me the bytes version of probably UTF-8 (not sure). I can't seem to be able to decode it, and i think the reason is not knowing what encoding is done in the actual console. The below is simply an exercise for me to understand how to work with hebrew. I also tried to place a "u" before a list item.. didnt work or i didnt have the right syntax to handle in a list.
I am using Python 2.7.8 and the Python IDLE editor. My OS - win7 64bit This is the code
#!/usr/bin/python
# -*- coding: utf8 -*-
word=raw_input('בחר מילה')
print word
loc=[]
for i in word:
print i
print type(i)
word=word+i
loc.append(i)
print loc
This is the output
בחר מילהשמש
שמש
ש
<type 'str'>
מ
<type 'str'>
ש
<type 'str'>
['\xf9', '\xee', '\xf9']
How can switch the list items into hebew letter? Thanks for the help