Skip to content

Commit 467e994

Browse files
committed
Add UTF-8 character support
1 parent f30feac commit 467e994

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/arguments/utility.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
# Required for Questions Panel
88
import os
99
import time
10+
import locale
1011
from collections import defaultdict
1112
from simple_term_menu import TerminalMenu
1213
import webbrowser
13-
import time
1414

1515
from .error import SearchError
1616
from .save import SaveSearchResults
@@ -106,7 +106,7 @@ def add_to_playbook(self, stackoverflow_object, question_id):
106106
"""
107107
if self.is_question_in_playbook(question_id):
108108
SearchError("Question is already in the playbook", "No need to add")
109-
sys.exit()
109+
return
110110
for question in stackoverflow_object.questions_data:
111111
if(int(question[1])==int(question_id)):
112112
content = self.playbook_content
@@ -209,9 +209,10 @@ def return_formatted_ans(self, ques_id):
209209
with console.capture() as capture:
210210
console.print(markdown)
211211
highlighted = capture.get()
212-
box_replacement = [("─", "-"), ("═","="), ("║","|"), ("│", "|"), ('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"), ("╔", "+"), ("╚", "+"), ("╗","+"), ("╝", "+"), ("•","*")]
213-
for convert_from, convert_to in box_replacement:
214-
highlighted = highlighted.replace(convert_from, convert_to)
212+
if locale.getlocale()[1] !='UTF-8':
213+
box_replacement = [("─", "-"), ("═","="), ("║","|"), ("│", "|"), ('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"), ("╔", "+"), ("╚", "+"), ("╗","+"), ("╝", "+"), ("•","*")]
214+
for convert_from, convert_to in box_replacement:
215+
highlighted = highlighted.replace(convert_from, convert_to)
215216
return highlighted
216217

217218
def navigate_questions_panel(self, playbook=False):

0 commit comments

Comments
 (0)