Menu

#32 Bluefish selecting wrong, non-UTF8 encoding based on source

None
closed
nobody
2023-02-23
2020-07-07
No

Bluefish is selecting a non-UTF8 encoding based on reading Python source code, namely a function call with parameter ' encoding="ISO-8859-1" '. This can be fixed by splitting that string parameter into a plus-concatenation. See attached files.

3 Attachments

Discussion

  • Olivier Sessink

    Olivier Sessink - 2020-07-07

    yes I understand why this is happening.

    what I don't know: is python sourcecode alsways in UTF-8 ? If so we can force UTF8 for every python file. If not we have to try and guess (which we currently do, resulting in the problem you describe)

     
  • Miguel Simoes

    Miguel Simoes - 2020-07-07

    Python allows specifying the source file encoding at either the first or second line, see https://www.python.org/dev/peps/pep-0263/ . A regular expression is provided there for allowed directive formats. Default is ASCII for Python2 and UTF8 for Python3.
    I would suggest a printed warning for this type of situations, which override preferences and locale.
    Finally, the "Document/Character Encoding" options seem to do nothing in this case, but I didn't research much.
    Cheers and let me know if I can help.

     
  • Olivier Sessink

    Olivier Sessink - 2020-07-07

    I just found https://www.python.org/dev/peps/pep-0263/ which describes the proper python encoding.

     
  • Olivier Sessink

    Olivier Sessink - 2020-07-07

    encoding detection according the pep-0263 is now properly detected in revision 8872

     
  • Dr. Martin Senftleben

    • labels: --> python, encoding
    • status: open --> closed
     
  • Dr. Martin Senftleben

    Closing as the issue has been resolved. If not, please open a new ticket.

     

Log in to post a comment.

MongoDB Logo MongoDB