
Vector3d.ToString() et al are not locale-safe
Posted Sunday, 20 June, 2010 - 18:54 by anathema| Project: | The Open Toolkit library |
| Version: | all versions |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | open |
Jump to:
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
#1
Edit: you are right, this is not locale-safe. I'll see what can be done.
#2
#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)
#4
I think the most sensible approach would be to find out what XNA does and do the same here.
#5
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 :-)
#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...
#7
There's a List Separator in the region settings, maybe that is accessible through .NET localization functionality somehow.
#8
You mean this?
http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.li...
#9
Yes.
#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}?