anathema's picture

Vector3d.ToString() et al are not locale-safe

Project:The Open Toolkit library
Version:1.1-2014-01-02
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm raising this as a bug as I think it's a bit of a useability issue, but please feel free to disagree!

        public override string ToString()
        {
            return String.Format("({0}, {1}, {2})", X, Y, Z);
        }

The above isn't suitable for use in cultures which use the comma as the decimal-separator. This means my German beta-tester sees this...

(1,0, 1,1, 1,0)

Are there any plans to change this? :-)


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Edit: you are right, this is not locale-safe. I'll see what can be done.

the Fiddler's picture

#2

Status:open» confirmed
c2woody's picture

#3

What do you want to do? Have (1.0, 1.0, 1.0) always or use (1,0; 1,0; 1,0) on systems that use , for decimal separation? (both is possible of course)

the Fiddler's picture

#4

I think the most sensible approach would be to find out what XNA does and do the same here.

anathema's picture

#5

Status:confirmed» open

I was rather surprised that there doesn't appear to be anything in the CultureInfo system to cover this case. However, I've - so far - been unable to locate anything to suggest what's normally done in such cultures. The semi-colon just looks weird to me...but then again, so does the comma-as-decimal-separator :-)

anathema's picture

#6

Poking around inside the Media3D namespace, it appears that MS use the ';' when the decimal-sep is the ',' and the ',' otherwise. There's a handy little class called TokenizerHelper which provides this functionality, but unfortunately it's internal :-(

Not that it's difficult to implement of course...

c2woody's picture

#7

There's a List Separator in the region settings, maybe that is accessible through .NET localization functionality somehow.

anathema's picture

#8

c2woody's picture

#9

Yes.

nythrix's picture

#10

Excuse my ignorance but what's wrong with plain {1.0 1.0 1.0 1.0} or {1,0 1,0 1,0 1,0}?