icu-dotnet icon indicating copy to clipboard operation
icu-dotnet copied to clipboard

Exposed u_getIntPropertyValue & u_hasBinaryProperty; Added UEastAsianWidth

Open TJYSunset opened this issue 7 years ago • 0 comments

Why am I exposing the two methods

Yes, I have read the <remarks> documentation tag on u_getIntPropertyValue.

This not only makes it easier to use

But this implementation is seriously incomplete. I failed to take "no usable interface at all" as "easier to use".

but more importantly it prevents accidental use of the UCHAR_GENERAL_CATEGORY, which returns an enumeration that doesn't match the enumeration in FwKernel: LgGeneralCharCategory

(Google didn't tell me what is FwKernel or LgGeneralCharCategory. Pardon my naive assertions...)

It's up to the user to make a legitimate API call. If the original icu4c (and many other wrappers like Android) exposed it, why should this middleware hide it?

Plus, the wrapped GetIntPropertyValue can simply throw an exception when UCHAR_GENERAL_CATEGORY is passed, in case it will cause a critical issue.

Tests

icu.net | icu.net.tests | BreakIteratorTests_Chinese <.NETCoreApp-v2.1> | CanIterateBackwards somehow failed on my machine with

  Expected is <System.Int32[12]>, actual is <System.Int32[18]>
  Values differ at index [1]
  Expected: 2
  But was:  1

   at Icu.Tests.BreakIteratorTests_Chinese.CanIterateBackwards() in icu-dotnet\source\icu.net.tests\BreakIteratorTests.Chinese.cs:line 294

not sure if my changes broke it.


This change is Reviewable

TJYSunset avatar Jul 29 '18 13:07 TJYSunset