Hacker News new | ask | show | jobs
by bmn_ 3910 days ago
> There is really no way for a simple program to account for all of those possible edge cases.

The post to linked you contained a piece of boiler-plate code which accounts for said cases.

> Have you considered how your formatting is going to look when people intersperse Right to Left words in your output for example?

There are modules to handle this. It of course means that you have to stop using non-Unicode-aware functions like `sprintf`.

1 comments

The boilerplate on there is only a start. Any time you read or write a Unicode string, or do any manipulation of the string, you need to consider possible edge cases, and they can be nightmarish.

Consider something as simple as outputting zero padded numbers (so they form a nice column in the output), except that the numbers might not be Arabic, zero might not be 0, they might not be written in the direction you expect, and padding might not even make sense. This is how you go crazy.