mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.39k stars 433 forks source link

Fail of "make check" for cp1250 #2408

Open Gregor14 opened 1 year ago

Gregor14 commented 1 year ago

What were you trying to do?

I'm trying to do "make check"

What steps did you take to trigger the issue?

What did you expect to happen?

Pass whole procedure of testing

What actually happened?

I got error:

self = <encodings.cp1250.Codec object at 0x000001EA44A683D0>
input = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ'
errors = 'strict'

    def encode(self,input,errors='strict'):
>       return codecs.charmap_encode(input,errors,encoding_table)
E       UnicodeEncodeError: 'charmap' codec can't encode characters in position 97-99: character maps to <undefined>

..\Python\Python38\lib\encodings\cp1250.py:12: UnicodeEncodeError

Operating System Version

Windows 10 Home 22H2 Polish (cp1250)

Mu Version

1.2.1

Other Info

Problem is in test_logic.py at test_read_encoding_default(). This function attempt to encode this (line 3068): test_string = UNICODE_TEST_STRING.encode(locale.getpreferredencoding()) all is fine, when locale.getpreferredencoding() is equal "cp1252" or "cp65001". But when is equal "cp1250" then error happens. Solution could be i.e. change set of chars used by this test (line 3005) from: BYTES_TEST_STRING = bytes(range(0x20, 0x80)) + bytes(range(0xA0, 0xFF)) to: BYTES_TEST_STRING = bytes(range(0x20, 0x80)) But probably there are also better solutions.

BTW: This is not same problem as https://github.com/mu-editor/mu/issues/746#

Editor Log

No response