Reputation: 6308
I'm doing exactly this:
int level = ...;//some value from game
Analytics.newDesignEvent(String.format("level_end:%02d:win", level));
And I've found that some devices send strings with unicode symbols such as "٠١":
level_end:٠١:win
I've tried to reproduce it in my environment, but String.format worked ok with any integer value. May this be somehow caused by specific locales? Why else this can happen?
Updt2: I didn't find any info whether string + int/float/etc. concantenation also take locale into consideration. Do smbd happen to know?
Upvotes: 2
Views: 1701
Reputation: 6308
In java docs it is said:
Number localization. Some conversions use localized decimal digits rather than the usual ASCII digits. So formatting 123 with %d will give 123 in English locales but ١٢٣ in appropriate Arabic locales, for example. This number localization occurs for the decimal integer conversion %d, the floating point conversions %e, %f, and %g, and all date/time %t or %T conversions, but no other conversions.
Btw ٠١ means 01 in arabic numbers. So I'll replace my calls to
String.format(Locale.US, "level_end:%02d:win", level)
and will see does it help.
Upvotes: 3