Skip to content

Commit

Permalink
add unicode support (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Yeongmin Kim <[email protected]>
  • Loading branch information
gunjasal and yeongmin-kim-nhn authored Dec 2, 2022
1 parent 6b2f948 commit a811f8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
8 changes: 5 additions & 3 deletions gwkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import getpass
import httplib
import io

logger = logging.getLogger('gwkit')
logger.addHandler(logging.FileHandler('gwkit.log'))
Expand Down Expand Up @@ -166,6 +167,7 @@ def _print_color_text(self, text, index, y, x, width):
text_length = 0
words = text.split(' ')
for word in words:
word = word.encode('utf-8')
color_index = 0
if index == self.selected_server_idx:
color_index += 1
Expand Down Expand Up @@ -531,7 +533,7 @@ def init_server_list():
html = get_session_cookies.text
actionStartIndex = html.find('action=') + 8
print actionStartIndex
actionEndIndex = html.find('" method', actionStartIndex)
actionEndIndex = html.find('" method', actionStartIndex)

loginUrl = html[actionStartIndex:actionEndIndex].replace('&amp;', '&')

Expand Down Expand Up @@ -591,8 +593,8 @@ def init_server_list():
i += 1
print ""

final_result = str(result).replace("\'", "\"")
f = open(server_list_json_file, 'w')
final_result = str(result).decode('string-escape').decode("utf-8").replace("\'", "\"")
f = io.open(server_list_json_file, 'w', encoding='utf-8')
f.write(final_result)
f.close()

Expand Down

0 comments on commit a811f8a

Please sign in to comment.