I'm trying to read a CSV file that contains information in simplified Chinese, and encode it into a request to put into the database.
Section of my code:
#coding:utf-8
import csv, sys, urllib, urllib2
with open('testdata1.csv', 'rU') as f:
reader = csv.reader(f)
try:
z = csv.reader(f, delimiter='\t')
for row in reader:
print row[0]
if row[0] in (None, ""):
continue
elif row[0] == '家长姓':
print row[0]
However I'm encountering two problems:
1) Sublime Text cannot understand Chinese characters, aka it does not understand to look for '家长姓' in the command elif row[0] == '家长姓'
.
2) Sublime Text doesn't seem to be able to print Chinese characters (when I tell it to print some of the information, all Chinese characters are replaced by underscores).
I've already tried File>Save with Encoding>UTF-8 to no avail. Any help would be appreciated.