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.

One Response to “Tracking down decimal 146”

1. Good advice – I am currently using Liquid XML instead of Spy or Oxygen because *those* licenses were apparently purchased by my previous project; but in a lot of ways I got more mileage out of Jedit than any of the others, particularly the XQuery, XSLT and WebDav plugins. Very useful with native XML databases like exist too.