diff --git a/pysollib/hint.py b/pysollib/hint.py index 562c48cd..e37c08a8 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -879,7 +879,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint): # Based on https://stackoverflow.com/questions/8898294 - thanks! def mydecode(s): if sys.version_info < (3,): - return s + pass # return s for encoding in "utf-8-sig", "utf-8": try: return s.decode(encoding) diff --git a/tests/lib/pysol_tests/import_file1.py b/tests/lib/pysol_tests/import_file1.py index d1f8f126..de76ad86 100644 --- a/tests/lib/pysol_tests/import_file1.py +++ b/tests/lib/pysol_tests/import_file1.py @@ -118,6 +118,20 @@ KD QC 5C QH 6S 3D 8S 7H 3H 2C AC 7D ''', 'import worked with Ts') + def test_import_utf8_bom(self): + return self._successful_import( + 'tests/unit/data/624-with-utf8-bom.board', + '''FC: - - - - +KC 6H 4C QS 2D 4S AS +4H TH 2S JH 2H 9S AH +3S 6C 9H AD KH QD 7C +3C JS 5H KS TC 9C 8C +4D 9D 7S JC 5D TS +KD QC 5C QH 6S 3D +5S JD 8D 6D TD 8H +8S 7H 3H 2C AC 7D +''', 'import worked with utf-8 bom') + def mymain(): from pycotap import TAPTestRunner diff --git a/tests/unit/data/624-with-utf8-bom.board b/tests/unit/data/624-with-utf8-bom.board new file mode 100644 index 00000000..3bf83178 --- /dev/null +++ b/tests/unit/data/624-with-utf8-bom.board @@ -0,0 +1,8 @@ +: KC 6H 4C QS 2D 4S AS +: 4H TH 2S JH 2H 9S AH +: 3S 6C 9H AD KH QD 7C +: 3C JS 5H KS TC 9C 8C +: 4D 9D 7S JC 5D TS +: KD QC 5C QH 6S 3D +: 5S JD 8D 6D TD 8H +: 8S 7H 3H 2C AC 7D