Feb 062013

This goes into the ‘saves time’ category and is slightly too long to fit into 140 characters.

If you’re using XSLT on some XML file that has had a miscellaneous history and you see the error Illegal HTML character: decimal 146 (or something similar), don’t panic or break out your hex viewer to try to find the random character that’s causing the problem.

Get jEdit instead. Open the file in jEdit, and go to the menu Utilities -> Buffer Options. In the character encoding drop-down, choose Windows-1252. The error message(s) will point you right at the offending character(s). For added fun, repeat with ISO-8859-1 to flush out other odd characters that aren’t illegal, but may not show up correctly depending on your down-stream processing (ligatures, etc.). Then switch back to UTF-8 or whatever you need, save, and you’re done!

JEdit also has decent XML features if you install the plugins, an added bonus.

/* ]]> */