Skip to main content
Rick E Johnson
Inspiring
February 25, 2022
Answered

Using IUStringUnitsToAIReal, ignores European decimal [,]

  • February 25, 2022
  • 1 reply
  • 226 views

With my locale set to Germany, I'm using a comma decimal separator [,] and period thousands separator [.]. When IUStringUnitsToAIReal parses the text, it ignores the [,] decimal separator. My units are set to mm. I see in Illustrator's own fields, it's using the comma as decimal separator. AI is not using a thousands separator, which is not a problem here.

 

AIReal pts_;

std::string input_ = "1,5"; // From Adobe header: The string to convert, which uses the localized international utilities (IU) decimal separator.

sAIUser->IUStringUnitsToAIReal(ai::UnicodeString(input_), &pts_);


pts_ is now set to 42.519685039370081, but should be 1/10 that (4.2519685039370081). Am I doing something wrong?

This topic has been closed for replies.
Correct answer Rick E Johnson

I think I'm making progress. Working with Points as ruler units, "1,5" should equal 1.5, but instead I get 15. However:

 

sAIUser->IUStringToAIReal(pts_, 4, us);

// pts_ == 1.5!

ai::UnicodeString us;

sAIUser->IUAIRealToStringUnits(pts_, 4, us); // works!

 

IUStringToAIReal and IUAIRealToStringUnits work as expected. I suspect there's a bug in IUStringUnitsToAIReal.

1 reply

Rick E Johnson
Rick E JohnsonAuthorCorrect answer
Inspiring
February 25, 2022

I think I'm making progress. Working with Points as ruler units, "1,5" should equal 1.5, but instead I get 15. However:

 

sAIUser->IUStringToAIReal(pts_, 4, us);

// pts_ == 1.5!

ai::UnicodeString us;

sAIUser->IUAIRealToStringUnits(pts_, 4, us); // works!

 

IUStringToAIReal and IUAIRealToStringUnits work as expected. I suspect there's a bug in IUStringUnitsToAIReal.