Skip to content

Unicode file-names not displayed properly in Console  #75

Description

@Yaron10

default

As you can see, the entire path is not displayed properly.

Thank you.

Activity

  1. chcg commented on Jun 7, 2018

    @chcg
    Collaborator

    @Yaron10 With which version of the plugin. Could you also paste as short example code which triggers this issue. Is it just the displaying of the error message or is it also not possible to use unicode path.

  2. Yaron10 commented on Jun 7, 2018

    @Yaron10
    Author

    @chcg,

    With which version of the plugin.

    v1.1.0.53.

    Could you also paste as short example code which triggers this issue.

    editor.copy(

    Add that line to a file, save it as טסט.py and place it in the scripts folder.
    On running it (no problem in this regard), you get the second error shown in the screenshot above: the file-name (טסט.py) is displayed as 84F5~1.py and the path (C:\Program Files\Notepad++\NP\plugins\Config\PythonScript\scripts) is also wrong.

    Thank you for looking into it. I appreciate it.

  3. chcg commented on Jun 8, 2018

    @chcg
    Collaborator

    Unfortunately that is not wrong, but just the short path name (https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx) of the file used behind the scenes to access unicode file names/path, because direct input of the unicode name to python api didn't work.

    Maybe this could be changed with python 3 (#36), but currently I see no chance to modify that without breaking unicode script filename support from #60.
    Also the file link in the console error output is working for me.

  4. Yaron10 commented on Jun 8, 2018

    @Yaron10
    Author

    Thank you for the explanation.
    And thanks again for looking into it.

    Maybe this could be changed with python 3 (#36),

    So I suppose this issue shouldn't be closed for the time being.

  5. chcg commented on Jun 10, 2018

    @chcg
    Collaborator

    Let's keep it open, but currently I see no easy fix based on python 2.7. Maybe some deeper inspection of the python sourcecode gives some hints, if UTF-8 filenames are supported, but from the current checks, tests and internet searches it doesn't look promising that this is possible. Therefore the "workaround" with the windows shortname was chosen.

  6. Yaron10 commented on Jun 10, 2018

    @Yaron10
    Author

    Thanks again. I appreciate your work.

    Allow me another related question.

    STR:
    Open a file named טסט.txt in NPP.
    Run (from the console or in a script) notepad.getCurrentFilename().

    Result:
    default

    Is that fixable?


    Off-topic but still related:
    Can I pass $(FULL_CURRENT_PATH) to a python-script via a command in shortcuts.xml?

    Thank you.

  7. chcg commented on Jun 15, 2018

    @chcg
    Collaborator

    Regarding notepad.getCurrentFilename() and the corresponding result. This seems to be a problem within:

    void PythonConsole::writeText(boost::python::object text)
    {
    assert(mp_consoleDlg);
    if (mp_consoleDlg)
    {
    if (PyUnicode_Check(text.ptr()))
    {
    boost::python::object utf8String(boost::python::handle<PyObject>(PyUnicode_AsUTF8String(text.ptr())));
    std::string textToWrite((const char *)boost::python::extract<const char *>(utf8String), _len(utf8String));
    GILRelease release;
    mp_consoleDlg->writeText(textToWrite.size(), textToWrite.c_str());
    }
    else
    {
    std::string textToWrite((const char *)boost::python::extract<const char *>(text.attr("__str__")()), _len(text));
    GILRelease release;
    mp_consoleDlg->writeText(textToWrite.size(), textToWrite.c_str());
    }
    }
    }

    the input as boost::python:str is UTF8 encoded, but detected as plain string by PyUnicode_Check(). That seems to show it just as encoded version. Need further investigation.

  8. Yaron10 commented on Jun 15, 2018

    @Yaron10
    Author

    @chcg,

    Thank you for looking into the issue and further investigating it.

  9. added this to the v3.0 milestone on Sep 7, 2020
  10. chcg commented on Sep 7, 2020

    @chcg
    Collaborator

    @Yaron10 I just retested the described issues with the current alpha release https://github.com/bruderstein/PythonScript/releases/tag/v3.0.4 and the issues seems to be fixed with the update to python3 and the changes in the script file loading.

  11. Yaron10 commented on Sep 7, 2020

    @Yaron10
    Author

    @chcg,

    Thank you for your work and for updating here. 👍
    I'd rather wait a bit before switching to v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions