0

I have to use Turkish characters, when I write "chcp" in cmd, I see 857. So I tried to start my programs with:

# -*- coding: cp857 -*- 

but nothing changed.Still I cant see Turkish characters like "ş,İ,Ş,Ğ" etc.

So I tried to start my programs with:

# -*- coding: cp1254 -*-  

with this,I can see the Turkish characters,BUT when my program needs data from user, I cant see the Turkish characters again so my program is nothing. its like:

name=raw_input("Please enter your name: ")
print name
--------
Please enter your name: Ayşe
A*/8e

so,if I have to find user's name in a list in my program, I cant find "Ayşe" because program doesnt understand Turkish characters, but it shows Turkish characters at the beginning of program.The problem appears when I need data from user.. It doesnt make any sense, I really want to know why and how can I fix it.I tried tons of methods,none of them works..

2 Answers2

0

Have a read of How to read Unicode input and compare Unicode strings in Python?, it should help you understand why raw_input isn't reading the name as you expect.

Community
  • 1
  • 1
Scott C
  • 1,660
  • 1
  • 11
  • 18
  • UnicodeEncodeError: 'ascii' codec can't encode character u'\u015f' in position 0: ordinal not in range(128) I got this error when I tried that method you posted my friend –  Nov 28 '14 at 02:23
0
  1. type chcp 65001 in console
  2. right click the cmd window and change fonts to Lucida console

This is a duplicate of Unicode characters in Windows command line - how?

Also, you should really avoid users writing to console, it creates unnecessary complication to both you and the user

Community
  • 1
  • 1
Symba
  • 86
  • 9