diff --git a/src/utils/ansi.py b/src/utils/ansi.py index 4a896d1ad7..4abdd39332 100644 --- a/src/utils/ansi.py +++ b/src/utils/ansi.py @@ -15,6 +15,7 @@ user. """ import re from src.utils import utils +from src.utils.utils import to_str # ANSI definitions @@ -355,7 +356,7 @@ class ANSIString(unicode): string to be handled as already decoded. It is important not to double decode strings, as escapes can only be respected once. """ - string = args[0] + string = to_str(args[0], force_string=True) if not isinstance(string, basestring): string = str(string) parser = kwargs.get('parser', ANSI_PARSER) diff --git a/src/utils/evform.py b/src/utils/evform.py index 3d99aeb7c9..a17aa3d2b4 100644 --- a/src/utils/evform.py +++ b/src/utils/evform.py @@ -101,7 +101,7 @@ This produces the following result: | |**|* | Herbalism |14 |990/1400 | | |* | | Smithing |9 |205/900 | | | | - ------------------------------------------------ + `----------------------------------------------ยด The marked forms have been replaced with Cells of text and with EvTables. The form can be updated by simply re-applying form.map() @@ -120,7 +120,6 @@ form will raise an error. import re import copy -from src.utils.ansi import ANSIString from src.utils.evtable import Cell, EvTable from src.utils.utils import all_from_module, to_str, to_unicode @@ -371,7 +370,7 @@ class EvForm(object): self.tablechar = tablechar[0] if len(tablechar) > 1 else tablechar # split into a list of list of lines. Form can be indexed with form[iy][ix] - self.raw_form = ANSIString(datadict.get("FORM", "")).split("\n") + self.raw_form = to_unicode(datadict.get("FORM", "")).split("\n") # strip first line self.raw_form = self.raw_form[1:] if self.raw_form else self.raw_form diff --git a/src/utils/evform_test.py b/src/utils/evform_test.py index 084195f249..03d2e49ebb 100644 --- a/src/utils/evform_test.py +++ b/src/utils/evform_test.py @@ -7,7 +7,7 @@ FORMCHAR = "x" TABLECHAR = "c" FORM = """ -.------------------------------------------------. +{c.------------------------------------------------. | | | Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx | | xxxxxxxxxxx |