Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating Delphi DFM's with special characters to D2009

I've got a number of Delphi forms where we use a couple of special characters - the 'degree' symbol, and the 'ohms' symbol. These characters are used in label captions saved in the DFM file and are not generated or modified at runtime. Back along when we first designed these forms the degree symbol was easy because it is in the Ansi character set (code 176) but the ohms symbol needed the greek charset to be used with code 217. Fortunately (we found) all other characters that we need (letters and numbers) work fine with the greek charset.

Now we would like these forms to look the same in D2009. The degree symbol appears fine but the ohms symbol shows 'Ù' because the dfm text is "Caption = 'Typed in Ohms - 1234 '#217". I find that I can edit the form to put in the correct unicode ohms symbol (8486) but of course this is lost to a '?' when going back to D7. Ideally I'd like to tell D2009 to continue to use the greek charset with the form so that #217 in the dfm maps to the ohms symbol. Is this possible? It seems to ignore the Font.Charset setting which is 'GREEK_CHARSET'. I have discovered a dirty way of solving this which is to iterate through all the components and doing "StringReplace( S, 'Ù', OhmsChar, [rfReplaceAll] )", but this is horrible and surely there must be a better way?

Thanks, Brian

like image 880
Brian Frost Avatar asked Jan 23 '23 15:01

Brian Frost


1 Answers

Similar issue I had was solved by using dxgettext. Instead of problematic captions, I just used clean ascii (eg. "Typed in Ohms"), and then translated them in po files, embedded in exe as resources.

BTW, dxgettext is a nice way to add translations to app, with a very little overhead and standard formats (po/mo) with good 3p editors (poEdit). Works with D7 and D2009.

like image 50
dmajkic Avatar answered Feb 02 '23 08:02

dmajkic