I just noticed, that my application is unable to store the euro symbol € - I even tried with TopScan, it’s just replaced with a _ - any idea why that is? How can I fix this? Or do I have to build in logic to save it differently and then on loading change it back?
I know it’s Unicode U+20AC, but just runny work in Classroom limited to 8 bit characters. I searched and got the same answer as @henkouwejan
The Euro symbol (€) in Windows is generally encoded as hex byte 0x80 in Windows-1252 (Western European) character set. The easiest ways to type it are Alt+0128 (using the number pad),
Oh I can type it in just fine with CTRL+ALT+5 (on a keyboard with the euro on the 5) but when it’s saved to the database file it gets replaced with an underscore, even in TopScan the same happens.
The column type is STRING if that matters
yes but that might be “typing” Unicode U+20AC that Carl mentioned. You want ‘<128>’ in the string as both Henk and Carl pointed out.
you could test simply by typing the Euro into notepad and view it in hex.
then your one character string ‘<128>’ would appear as ‘80’ in hex.
I tried that, with the ALT+0128 - but sadly it still changes to a _ (I did this inside the TopScan program and my software, to check) - Weird thing is, inside my software it stays a EURO symbol until it’s saved to the Database and loaded back
I tried typing Alt+0128 into a string field of my application and saving the record. It works just fine.
What is your “Language for non-Unicode programs” Windows Control Panel setting? Clarion does not support Unicode so for some non-US characters it is required to change that to your country locale.
It’s set to Dutch for me, as I am Dutch - but like I said, even with ALT+0128 it just replaces it with an _ - even in TopScan
Just created a new dict with a new application as test - and there I can store a EURO in a STRING column - weird thing is, I cannot find anything different between the dictionaries in relation to column settings
I figured out what the issue is, it’s OEM setting on the Table - If I set it enabled, it changes the € to _ - if disabled, it does not - sadly file has to be re-created to make it work Data Version Control doesn’t pick this up - any ideas?
Next up I thought, let’s try and use CALLBACK to catch this, didn’t work - let’s try Dictionary Triggers - don’t seem to run for some reason (Maybe TopSpeed doesn’t support it, cannot find anything about it)
OEM setting refers to the old DOS code page setting, used in CFD 3.1 and earlier Clarion versions. My earliest one was Clarion 2 (for DOS). My gut feel is that nothing was changed in that code since 80’s and there was no Euro at the time. Clarion seems to be the last programming language in the world still not supporting unicode. Even Fortran does, whilst SoftVelocity still focuses on explaining why it is difficult. Regardless of this more than 20 years old article The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) – Joel on Software
The question remains, how does one disable the OEM setting on an existing data file? With it disabled, I can store the € (ASCI 128) inside the data file without issues
Copy your data to a new file which has OEM disabled?
Rename the new file after copying.
Test
You need to do a file conversion. I think the help covers it. Its also in some tutorials.
If you just need to do it one time you can do it all in the IDE DCT.
First change the DCT file to not have OEM.
Second view the data file in the DCT.
It should popup a message to ask if you want the file converted.
Answer yes and you have it without OEM.
Rebuild your solution so that file in code is without OEM.
You would have to do this with your customers actually data file.
The other way is to create a conversion program EXE.
You copy the original file in the DCT.
Call it MyFileV1.
So you have it with OEM to open as is now
Remove OEM from the current file
In the IDE DCT is a way to “Create Conversion”
It’s a simple program with both file declarations that simply reads all the records from V1 and writes to V2 without OEM.
A simple CLW and Project are created so you can modify it and see how it works.
The file names on disk have to be delt with as they both cannot be the same.
It’s been a while since I last used OEM attribute, old DOS code pages are now ancient history, but basically what it does is it tells Clarion to store your data in a different code page that Windows uses for your language. For Dutch your Windows code page is is Windows-1252, with OEM attribute it’s stored in Code Page 850 (MS-DOS Latin-1) and converted on the fly when you fetch data from your data file. What I found googling is that there are actually 2 code pages for Dutch language for MS-DOS
Code Page 850 (CP850): The standard Western European DOS code page used for Dutch.
Code Page 858 (CP858): A variant of CP850 updated to include the Euro symbol (€).
Since your data is stored in CP850 the only thing that comes to mind is to write a conversion program using CONVERTOEMTOANSI statement to convert all your strings in your table to Windows-1252. Then remove OEM attribute from your dictionary and recompile. Alternatibely you can see if there is any way to use CP858 for your data files with OEM attribute. Check out “localization” topic in Claron help.
