Apache OpenOffice (AOO) Bugzilla – Issue 41672
Numbers inappropriately formatted using Thai digits
Last modified: 2013-08-07 15:00:08 UTC
When OS locale is set to Thai, numbers in various places will be displayed using Thai digits. This has been tested on Windows and Linux. I also found the same problem with other locales that have non-ASCII digits, such as Hindi and Arabic. It happens no matter what locale is set in 'Tools/Options/Language Settings/Languages/Locale setting', even when 'Language Setting/Complex Text Layout/Numerals' is set to Arabic, and even when 'Language Setting/Languages/Enabled for complex text layout' is disabled. Test cases :- Windows: a) Set the OS locale using 'Control Panel/Regional and Language Options/Standards and formats'. Set it to Thai. b) Run OOo (quickstarter may interfere with this so close it beforehand). Linux: a) Set the LANG environment to Thai. Use the command-line shell, type 'export LANG=th_TH' b) Run 'soffice' from the same shell. The problem will show up in :- - Writer a) On formatting toolbar, change the font size to any different number, then it'll be displayed using Thai digits. Change the style to any style name with number (e.g. Heading 1), then the number will be displayed using Thai digits (Heading เน). This is not what Thai expect. Thai rarely use Thai digits now. They're used only in some formal text. So having Thai digits in the UI looks strange. b) Type some numbers in the document (e.g. 123) then export to PDF. All (ASCII) numbers in the result pdf file will be printed using Thai digits. - Impress c) The numbers in the color drop-down list (e.g. Blue 7) on the line & fill toolbar are displayed using Thai digits. This happens in Draw too. d) Type some numbers in the presentation. They'll be displayed using Thai digits (but print correctly) - Calc e) Type some numbers in the data entry line, all numbers in the line will be displayed first using Thai digits then, after a quick refresh, using ASCII digits. I don't think I've covered all bugs related to this problem. All are the same, some numbers are displayed using Thai digits if the OS locale is set to Thai. Switch the OS locale back to, says English (US) or en_US and the problems gone. OOo has this problem since 1.1 (when it implemented the native numeral feature). In the older versions, it also shows this behavior when print too (all ASCII numbers printed using Thai digits, see issue 22181). But this is fixed because I don't see it again even in Impress which display numbers using Thai digits on screen but not in print.
FT: Karl, IIRC this wasn't really specified. So are there any internal hints how we handle Thai digits? If not I'd be happy to provide a short specification in this matter.
Created attachment 22093 [details] Quick & dirty patch that able to fix this bug in all places for all locale
To help you find the location and cause of this bug, I've attached a quick & dirty patch that able to fix this bug in all occurences in one place. Apply the patch and all problems I've described here will gone. The bug came from the fact that OutputDevice::SetDigitLanguage() sometimes use system language instead of using the one specified in the CTL setting dialog box. The patch is (too) simple, sending the setting from 'Tools/Language Settings/CTL/Numeral' dialog to vcl thru a static variable. This is a quick & dirty fix anyway, just to help you understand the problem.
Karl->FT: No, I don't have internal hints for this. It is in application layer to define how it should behaviour. I check Hebrew MS Office, it does not show native digital in UI.
FT: For 2.0 we should fix this issue. Please check your code if there are any hints why Thai numerals are sometimes shown in Arabic and sometimes in Thai. If you find the reason please fix it the way that Thai numerela are never and nowhere shown in the UI (regardless of the Arabic-Hindi setting). Thx a lot.
->hdu: Looks like a VCL issue.
Setting the digit language to the system language should not suffice to trigger digit substitution. The digit language has to be explcitly set. Fixed in CWS vcl36.
I apply the patch from http://gsl.openoffice.org/nonav/source/browse/gsl/vcl/source/gdi/outdev3.cxx?r1=1.189.8.3&r2=1.189.8.4&only_with_tag=cws_src680_vcl36&diff_format=u to my copy of OOo 680_m69 build. It really solves all the bugs I report here. However, there's a new bug. When the Numeral setting is set to Hindi - in Calc, the numbers in the cells will be in Hindi (which is right) but, in impress, there's a strange behavior. 1) set Tool/Options/Language Setting/CTL/Numberals to Hindi 2) run Impress 3) type some numbers in a presentation, it'll be in Arabic 4) deselect the frame 5) select the frame again (by clicking on it), the numbers will be in Hindi 6) type something in the frame, the numbers will be in Arabic again. That is, the numbers in the frame will be in Hindi when it's first selected and become Arabic when you type something. The problem occurs when the Numeral setting is set to Hindi only. When it is set to Arabic, the numbers are always in Arabic. When it is set to System, the numbers are always in Arabic too, no matter how the OS locale or Language Setting/Locale Setting is set. That is, if the Numeral setting is set to System and the OS locale is set to Thai, the numbers (e.g. in Calc cells) will still be in Arabic.
.
@samphan: thanks for the detailed description. Indeed the current fix triggers the described strange behaviour in impress. Would you mind to file a follow-up for this and provide a reference to this issue in it? Thanks a lot. Verified in cws 'vcl36'.
Verified in master m90 Build:8893 (internal build only sofar).