Fix LT-14982 and similar XHTML export crashes

* Handle sort rules with only ignorables
* Handle sort strings with ICU unicode escape characters
* Minor refactoring for readability

Change-Id: Ia78cb33b4276328ff7f1e940730331f77b4c204a