Skip to content

Commit

Permalink
prefer to use unicode in most inside logic ;
Browse files Browse the repository at this point in the history
  • Loading branch information
adaptee committed Nov 27, 2010
1 parent 4d5e905 commit 834df41
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pinyin-comp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_acronym(text):
for char in text:
acronym += acronymize(char)

return stringlize(acronym)
return acronym

def unicodelize(text):
"try to convert string into unicode string."
Expand Down Expand Up @@ -167,6 +167,7 @@ if __name__ == '__main__':
dironly = sys.argv[1]

path = sys.argv[2].replace("\\","")
path = unicodelize(path)
# support fuzzy pinyin
path = "".join( [ fuzzynize(x) for x in path] )

Expand All @@ -183,7 +184,7 @@ if __name__ == '__main__':
effective_basename = os.path.basename(effective_path)

if not dirname :
dirname = "./"
dirname = u"./"

# get all top-level subentries(non-recursive)
try:
Expand Down Expand Up @@ -242,7 +243,9 @@ if __name__ == '__main__':
except StandardError:
pass

reply.sort(key=locale.strxfrm)
# when dealing with outer world, always use native encoding
reply = [ stringlize(x) for x in reply]
reply.sort( key=locale.strxfrm )

if index :
try:
Expand Down

0 comments on commit 834df41

Please sign in to comment.