Hello, @claudia-svenson, @coises, @Freemeow and All,
@claudia-svenson, I did downloaded your sample.zip archive and extracted your sample.txt file
I tried to create a macro, from scratch, using the Macro > Start Recording and Macro > Stop Recording commands.
Unfortunately, looking within the Shortcuts.xml file, I realized that the Encoding > ANSI and the Encoding > UTF-8-BOM commands has not been saved in the macro !
BTW, @peterjones, I’m looking for a list of all commands which can be recordable, from scratch ! I also searched in the official documentation without success !
Thus, the only way to get a valid macro is :
Open your active Shortcuts.xml
Insert, right above the last </Macros> line, the folllowing text :
<Macro name="Correct ANSI chars in UTF-8 file" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="2" message="0" wParam="45004" lParam="0" sParam="" />
<Action type="0" message="2178" wParam="0" lParam="0" sParam="" />
<Action type="2" message="0" wParam="45005" lParam="0" sParam="" />
<Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
Save the current modifications
Close and restart Notepad++
Now :
Open your sample.txt file, in N++
Select the string of black chars xE4xF6xFC+xF6XFC
Just execute the Correct ANSI chars in UTF-8 file macro
You may also realize this same operation in two sequences :
Select the string of black chars xE4xF6xFC
Execute the Correct ANSI chars in UTF-8 file macro
Then :
Select the string of black chars F6XFC
Re-execute the Correct ANSI chars in UTF-8 file macro
Note that, if you want to test this macro with the original text of your sample.txt`file copied within a new N++ file, follow this method :
Open your sample.txt file in N++
Select all your text ( Ctrl + A )
Run the Edit > Paste Special > Copy Binary Content command
Open a new N++ file ( Ctrl + N )
Run the Edit > Paste Special > Paste Binary Content command
And, now :
Select the string of black chars xE4xF6xFC+xF6XFC
Execute the Correct ANSI chars in UTF-8 file macro
=> The Save dialog will occur
Save this new file with your desired name !
Best Regards,
guy038
Reminder :
If you installed N++ with an installer package, your active shortcuts.xml file should be within the folder %AppData%\Notepad++
If you installed N++ with a portable package, your active shortcuts.xml file should be along with the Notepad++.exe file, in your install folder