Help with making a simple plugin
-
I want to make a plugin that converts all opened files to UTF-8 or other if the opened file is in ANSI format.
I downloaded the example plugin and took a brief look at the code but did not really understand the structure of it and couldn’t really find anything useful on the wiki. If someone could point me in the right direction, i would greatly appreciate that. -
I assume you need to use these two messages
NPPM_GETNBOPENFILES
NPPM_SETBUFFERENCODINGto get the work done. But did you try to record a macro doing this conversion?
Or using python script or lua script plugin?Cheers
Claudia -
Thanks, I will look into those messages soon.
The reason I would like to make a plugin instead of a macro or script is that I want the conversion to be done automatically when I open any ANSI encoded file. I wouldn’t need this if Windows created UTF-8 encoded files but as it creates ANSI files instead, I need this plugin and fortunately it seems simple enough to make. -
NPPM_SETBUFFERENCODING works only for new and unedited files and i need to also modify opened files that have text in them.
Is there a message to convert the file to UTF-8?EDIT: I found it in the header files, IDM_FORMAT_CONV2_AS_UTF_8 and IDM_FORMAT_CONV2_UTF_8.