r/programminghelp • u/Tigerbalm788 • Mar 28 '23
C# NotePad++ Plugin - ANSI vs UNICODE
I'm trying to create a NotePad++ plugin using the Notepad++ plugin pack .NET (https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) and using C#. I am using v8.4.8 of NPP.
When I open NPP or try to debug my c# program it alerts me that:
This ANSI plugin is not compatible with your Unicode Notepad++.
I do understand that the .NET plugin pack requires the plugins to be UNICODE, however I have no idea what makes the plugin that I'm developing UNICODE vs. ANSI.
Is there some UNICODE vs ANSI setting somewhere in Visual Studio?
Is there something else that I may be doing that makes my plugin program considered ANSI?
My project references and uses functions from a.NET dll which I do not have the source code for (I'm combining the assemblies with ILRepack, per info I've found on the internet that indicates that NPP doesn't do well finding dll's external to the plugin itself). Is there something in this external dll that may be making the overall plugin to be considered ANSI? Is there something I can look at in that dll to see it's UNICODE vs ANSI info?
Any help or breadcrumbs in the right direction would be greatly appreciated.
EDIT: Moments after posting this, I was able to find a hint from the internet (even though what seems like 100s of previous searches were dead ends...). The dll that I was using took a string as an input. If I convert that string to UTF8, then it no longer is upset about UNICODE vs. ANSI. I do have other problems, but this issue seems to be resolved.
byte[] bytes = Encoding.Default.GetBytes(myString);
myString = Encoding.UTF8.GetString(bytes);