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.
anathema's picture


IMO it's easier to see the separation between the numbers if there's a non-space character in there.

the Fiddler's picture


Version:all versions» 1.0.0-rc1
Status:open» need info

Anyone knows what XNA prints in those cases?

iliak's picture


for Vector3 :

public override string ToString()
    CultureInfo currentCulture = CultureInfo.CurrentCulture;
    return string.Format(currentCulture, "{{X:{0} Y:{1} Z:{2}}}", new object[] { this.X.ToString(currentCulture), this.Y.ToString(currentCulture), this.Z.ToString(currentCulture) });
anathema's picture


Version:1.0.0-rc1» all versions
Status:need info» open

Hmm. Doesn't look too great, especially if you're displaying several Vector3d in a row:

{X:1.5 Y:2.5 Z:3.5}
{X:1.5 Y:2.5 Z:3.5} {X:1.5 Y:2.5 Z:3.5} {X:1.5 Y:2.5 Z:3.5}
AndyKorth's picture


anathema's picture


Is there any particular benefit to retrieving the value of ListSeparator each time it's used? I'd have stuck it in a private static readonly field myself.

the Fiddler's picture


Status:open» fixed

This fix has been merged for the next release.

the Fiddler's picture


Version:all versions» 1.1-2014-01-02
Status:fixed» closed

Closing bugs fixed in OpenTK 1.1.

If this is still an issue please file a new bug report at