anathema's picture

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

Project:The Open Toolkit library
Category:bug report

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? :-)


Comment viewing options

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


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

the Fiddler's picture


Status:open» confirmed
c2woody's picture


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


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

anathema's picture


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


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


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

anathema's picture


c2woody's picture



nythrix's picture


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}?