Windows. List separator and decimal point.

JesperMP

Lifetime Supporting Member + Moderator
Join Date
Feb 2003
Location
ᚴᚬᛒᛅᚾᚼᚬᚠᚾ
Posts
16,324
Hi all.

Is there a way to set the "regional settings" for list separator and decimal point ? Possibly with a script or batch commands or something.

I am writing some scripts in Win CC Flexible for accessing CSV files. My problem is that depending on which language is active, the list separator and decimal point changes. And this makes my scripts go wonky, because I have to use the list separator in the CSV file to know where the values are separated from each other.
Multiple languages is a feature that I am dependent on as my customers are in all countries over the world.

edit: To clarify, using english and german as example.
The list separator is typically "," in english and ";" in german.
The decimal point is typically "." in english and "," in german.

To get past this problem I would like to either make these two settings unchangable, or maybe I can force them to my preferred settings with a script or batch command. Any other imaginative solution is also welcome.

Anyone ?
 
Last edited:
Try to convince the Germans to change to the correct way. Also make them drive on the correct side of the road as well.:D


Sorry dont know, but it had to be said.
🤾
 
Try to convince the Germans to change to the correct way. Also make them drive on the correct side of the road as well.:D

They do drive on the RIGHT side of the road..
icon10.gif


Sorry Jesper I have no idea
 
JesperMP said:
Is there a way to set the "regional settings" for list separator and decimal point ?

Do you mean the settings in: hkey_current_user\control panel\international

There you'll find the settings for separators, etc. You can easily create a script to set these, but I would recommend reading the current values from the registry and using those in WinCC. I would not appreciate it if a script changed my settings without my knowledge.
 
One thing that was very annoying was swapped letters Y and Z on German keyboard, but I really liked easy access to all special characters used in engineering (degree, Alt+M = greek mu: etc.)
 
Jokes are wellcome, if they are good :)

stplanken,
I think you are pointing me in the right direction.
I can make a script that sets the registry values.
But it will be harder than one thinks.
When the language is changed, then Windows change the keyboard layout and also sets the regional settings like the list separator and the decimal point. And this can happen anytime. I have a hot-key in my Win CC Flexible application to switch languages.
So, I possibly have to find all installed languages and set the registry values.
I think that it is not a good strategy to find out what the regional settings are set to and then adapt my applicaton to it. If I allow the decimal point and list separator to change, then in the same CSV file there will be different list separators and decimal points. Thats impossible to sort out.

Panic mode,
I know where the regional settings are set. The problem is that the customer may install another language or install the application on another computer and then unknowingly screw up my scripts.
I will make instructions about the regional settings, but I prefer to force the values to the "correct" ones.

And yes, it is "funny" when editing in german in Win CC Flexible. Flexible "cleverly" switches to german keybord layout and that swaps the "y" and "z" keys.

Thanks to all.
 
JesperMP said:
But it will be harder than one thinks.
When the language is changed, then Windows change the keyboard layout and also sets the regional settings like the list separator and the decimal point. And this can happen anytime. I have a

Without knowing what exactly you're doing, you could add code to your WinCC script to dynamically read out the international settings from the registry and use that to create your CSV file (thought you mentioned Excel).

However, if you switch languages for the same CSV file, you could use any other separator character and script this in Excel, to force it to use that character.
 
No, what I am saying is that the regional settings can change any time. This because the regional settings follows the language and the user can change the language at will.

The problem is that I write some values to CSV files, if the decimal point for a floating value is "," and at a later time maybe the list separator also becomes "," ! I cannot stop this from happening. And how can I by a script decide if "," means "new value" or "decimal point in value" ?

To avoid it I want to set the list separator and decimal point fixed for any language.
 
Jesper,

Why can't you handle it the same way Excel does? When you are writing your csv file, if the list separator shows up in the data, you slap quotes around the data before you write it.

i.e. 1000 1001 1002 becomes 1000,1001,1002 in the csv file
but 1,000 1,001 1,002 becomes "1,000","1,001","1,002".

It appears that adding quotes to every data field even if not needed doesn't seem to cause any problems. Maybe that's the easy way out.

Good luck,
 
I will try that mellis. Thanks for the suggestion :)

But I have never heard that you could do like that. Is that standard for .CSV files ?
I use the Script command "Split" to split a text line into a number of values. I think that "Split" uses the list separator that is currently active in Windows to distinguish between values. In other words I have no control over the list separator.
But I will try your suggestion.

Even if your method works like that for I still have the problem with retrieving the data from the CSV file if the decimal point changes arbitrarily between "," and "."

The good thing about all this is that I learn a lot.
I havent grappled very much with scripts before.
 

Similar Topics

Hi everyone, I have an issue with installation of Studio 5000 33.00.02 DVD Media disc 2 with View Designer on Windows 11. After installation...
Replies
0
Views
97
Hello all, Hope everyone enjoying their weekend. I just recently bought a laptop to upgrade my old one with i3 its getting slow on me. But when i...
Replies
7
Views
398
I want to run a factory talk view ME project in a Panel View Plus 7 Performance HMI. The project was developed in a 'Windows 7 Professional 64 bit...
Replies
5
Views
332
Hi all. I received two identical brand new Dell desktops from a customer to install the softwares for a project. The first one is for a...
Replies
3
Views
511
Hey guys, I'm at a bit of a loss with a problem I'm having with some PVP 1250s and hoping for some advice. In firmware and application version...
Replies
0
Views
290
Back
Top Bottom