Stripping accents from my string

So here’s something kind of amazing. The Mac’s internal normalization fails the unicode.org unit test.

And my normalization fails on Windows.

And the Windows native normalization causes a hard crash.

Other than that, it’s going swimmingly.

1 Like

Well, at least I got my code working on Windows. It seems to be a difference in how some characters are processed through the Characters iterator. I think. Splitting the characters via Split( "" ) fixed the problem.

And I fixed the Windows crash, only to find that a number of tests fail there too.

I wonder if I should scrap the native normalization functions entirely in favor of my tested, but slightly slower, function…

If you like the cleaner look of a Select/Case construction, one trick is to do as below:

Select Case True
  
Case mName = "janvier"
  aMonth = 1
  
Case Left(mName, 2) = "fe"
  aMonth = 2
  
Case mName = "mars" 
  aMonth = 3
  
Case mName = "avril"
  aMonth = 4
  
Case mName = "mai"
  aMonth = 5
  
Case mName = "juin" 
  aMonth = 6
  
Case mName = "juillet" 
  aMonth = 7
  
Case Left(mName, 2) = "ao" 
  aMonth = 8
  
Case mName = "septembre"
  aMonth = 9
  
Case mName = "octobre"
  aMonth = 10
  
Case mName = "novembre"
  aMonth = 11
  
Case Left(mName, 2) = "de" 
  aMonth = 12
  
Case Else
  
  aMonth = 0 // Will generate a wrong date !
  
End Select

FYI, I’ve released my Unicode Normalization code in the M_String package, available here:

http://www.mactechnologies.com/index.php?page=downloads#m_string

2 Likes