Community
    • Login

    Inserting UTF-8 Text

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 3 Posters 364 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chester FritzC
      Chester Fritz
      last edited by Chester Fritz

      I am trying to create a plugin for inserting mathematical symbols for my mathematics documentation.
      I have used the following to accomplish this:
      SendMessageW(nppData._scintillaMainHandle, SCI_REPLACESEL, NULL,(LPARAM)text)

      However, after executing this command, the entire document view is temporarily changed to ANSI, causing my newly inserted character, as well as other UTF-8 characters to display incorrectly. If I change tabs, then return back to this one, the file view is reverted back to the default UTF-8 and the characters display correctly. I have tried various approaches to fixing this such as SCI_SETCODEPAGE with SC_CP_UTF8 as well as using WM_PAINT to no avail.

      Is there a way to fix this issue?

      EkopalypseE Alan KilbornA 2 Replies Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @Chester Fritz
        last edited by

        @Chester-Fritz

        I have not had such a problem yet.
        Could you give us an example of the text to be inserted and a document content so that it can be understood?
        Preferably as minimal as possible.

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @Chester Fritz
          last edited by Alan Kilborn

          @Chester-Fritz said in Inserting UTF-8 Text:

          SendMessageW(nppData._scintillaMainHandle, SCI_REPLACESEL, NULL,(LPARAM)text)

          This seems to be an extreme route to go to, to do this.
          Curious why you would try it this way – is there some advantage?
          I agree with @Ekopalypse that some more info about your workflow would definitely help.

          Perhaps THIS THREAD is of some interest.

          1 Reply Last reply Reply Quote 1
          • Chester FritzC
            Chester Fritz
            last edited by Chester Fritz

            I managed to solve the issue this morning after reviewing the source to the mime tools plugin.

            The following lines of code resulted in the data being displayed correctly.
            SendMessageW(nppData._scintillaMainHandle, SCI_TARGETFROMSELECTION, 0, 0);
            SendMessageW(nppData._scintillaMainHandle, SCI_REPLACETARGET, len, (LPARAM)text);

            Thank you for the assistance.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors