So, I think the solution to this is as follows
public static String formatNumber(Integer number, String prefix) { if (prefix == null) { prefix = Constants.PREFIX_SYMBOL; } StringBuilder stringBuilder = new StringBuilder(prefix); NumberFormat numberFormatter = NumberFormat.getIntegerInstance(); stringBuilder.append("").append(numberFormatter.format(number)); return stringBuilder.toString(); }
Removing Locale from a call to NumberFormat.getIntegerInstance(); seems to be doing the trick. This is added because some Locales will use non-ASCII decimal numbers when formatting integers, as indicated here . I do not think that this applies to the regions in which my application is available, so it should do the trick.
EDIT:
NumberFormat numberFormatter = NumberFormat.getIntegerInstance(new Locale("en_UK"));
can be replaced by
NumberFormat numberFormatter = NumberFormat.getIntegerInstance(new Locale("en", "GB"));
This will prevent locals from using default decimal digits without ASCII.
source share