tag:blogger.com,1999:blog-4129875579655863057.post5565249932376170657..comments2022-11-05T01:35:14.024-07:00Comments on Java Questions and Answers: Separating arguments to a function, in locales with comma as decimal markerjavatubehttp://www.blogger.com/profile/15526548399393457583noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-4129875579655863057.post-81369412492749840752012-04-12T07:38:10.898-07:002012-04-12T07:38:10.898-07:00We struck this exact problem when putting together...We struck this exact problem when putting together queries for our product using DB2.<br /><br />We had a query along the lines of:<br /><br />select fn (COLUMN_NAME,5.2) from TABLE_NAME<br />and the 5.2 was actually inserted dynamically by our software, based on a user selection (forget about injection attacks for now, they were prevented via another means).<br /><br />In locales where "five and two tenths" was written as 5,2 (darn those Europeans), we ended up with:<br /><br />select fn (COLUMN_NAME,5,2) from TABLE_NAME<br />which DB2 complained about bitterly.<br /><br />The IBM-given solution was to ensure that separator commas had spaces on either side and decimal commas did not:<br /><br />select fn (COLUMN_NAME , 5,2) from TABLE_NAME<br />But you'll find that many languages solve this problem in exactly the non-friendly way you mention. None of the ISO C-like standards (well, none that I know of, anyway) allow a constant number to be declared as 5,2, despite the fact that ISO is very much an "internationalised" organisation. They also don't require that keywords like if, while and for be localised into Arabic, or Mongolian, or Klingon :-)javatubehttps://www.blogger.com/profile/15526548399393457583noreply@blogger.com