Thank you very much for your reply.
I will take into account your comments on the use of backslashes in strings. However I don’t think that is the problem in my plug-in because the string I am using is just the first input argument from the method load_file(path, _status) from a custom Importer class. I just tried to avoid commenting all that in my code for simplicity and create my own string. That work around fails when executing
I would prefer to change the encoding directly on ruby though, but all this encoding stuff is a bit tricky for me. The code you posted is certainly changing the encoding of the file as it can be seen when it is open in notepad ++, but still is not the same that directly changing the encoding in notepad++.
In the figure below, top left panel is the original file with the wrong encoding, top right is how it looks when I just change the encoding using notepad++ (this file is read just fine by the plug-in). bottom panel is the resulting file after changing the encoding using your code, as you can see the encoding is UTF-8 but it looks very different and the plug-in doesn’t identify the text inside. Do you know a way to achieve top right result using ruby?
Other thing that would be useful for my plug-in is figuring out what is the encoding of the file so I just do the change it it is not UTF-8 (or UTF-8-BOM which also worked fine)