BdR76 / CSVLint

CSV Lint plug-in for Notepad++ for syntax highlighting, csv validation, automatic column and datatype detecting, fixed width datasets, change datetime format, decimal separator, sort data, count unique values, convert to xml, json, sql etc. A plugin for data cleaning and working with messy data files.
GNU General Public License v3.0
151 stars 8 forks source link

Make text replacement APIs respect the document's encoding #61

Closed rdipardo closed 1 year ago

rdipardo commented 1 year ago

Fixes #52 by refactoring the Scintilla-level API to use a variable encoding instead of assuming every buffer is UTF-8 as it does now. This protects ANSI files from corruption when being reformatted.

Just correcting ScintillaGateway.SetText() would've been enough to close the issue, but getting functions to work on selected ranges of text will involve something more like ScintillaGateway.ReplaceSel(), so might as well refactor everything we might need someday.

To test: reformat this ANSI file with the options:

CSVLint 0.4.6.2

Note: the lower half has been reformatted

csvlint-pre-patch-reformat

Current Git (patched)

csvlint-post-patch-reformat

BdR76 commented 1 year ago

Ha! 😀 I was just going to ask help on the forum for this encoding issue, becuase I had a hard time reproducing it. Thanks a lot for the PR, much appreciated 👍 I'll rebuild a development DLL and ask some people to check it out

Thanks again and happy Easter (ps: check the About form for an easter egg)