Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Chart.cs failing with th-th culture #944

Closed
PBrunot opened this issue Oct 29, 2022 · 1 comment
Closed

Example Chart.cs failing with th-th culture #944

PBrunot opened this issue Oct 29, 2022 · 1 comment

Comments

@PBrunot
Copy link
Contributor

PBrunot commented Oct 29, 2022

It seems that LastIndexOf with Thai culture has a weird behaviour, maybe because it is a right to left language : the 0 position starts at the last character and then backwards to string beginning.
Since the indexes are "backwards", other code based on LastIndexOf() fail.

I observed it when the string begins with a dot with LastIndexOf(".").

To reproduce the issue run the LineChart.cs NPOI example with : CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("th-th");

Exceptions happens in file extension strings manipulation code to generate the package during save.

@PBrunot
Copy link
Contributor Author

PBrunot commented Oct 29, 2022

To fix the exception in string manipulation, LastIndexOf must use StringComparison.Ordinal argument (see
https://www.jetbrains.com/help/resharper/StringLastIndexOfIsCultureSpecific.1.html )

PBrunot added a commit to PBrunot/npoi that referenced this issue Oct 29, 2022
tonyqus added a commit that referenced this issue Dec 29, 2022
@PBrunot PBrunot closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant