gdal icon indicating copy to clipboard operation
gdal copied to clipboard

SWIG/c#: Update string marshaling code to use utf-8 native strings

Open dz-fsd opened this issue 6 months ago • 3 comments

Update C# SWIG typemap to marshal array of strings as an array of utf-8 strings, as RFC 5 suggests.

This fixes generated c# bindings and makes .net code to work with the datasets containing non-ascii characters in the text data.

What does this PR do?

Fix SWIG/.net typemaps to treat strings in string arrays as utf-8 strings. This makes the datasets containing non-ascii characters in the text data usable by the .NET applications.

The use of UTF-8 in character data is mandated by RFC 5 (https://gdal.org/en/stable/development/rfc/rfc5_unicode.html).

What are related issues/pull requests?

Tasklist

  • [ ] AI (Copilot or something similar) supported my development of this PR
  • [ ] Make sure code is correctly formatted (cf pre-commit configuration)
  • [ ] Add test case(s)
  • [ ] Add documentation
  • [ ] Updated Python API documentation (swig/include/python/docs/)
  • [ ] Review
  • [ ] Adjust for comments
  • [ ] All CI builds and checks have passed

dz-fsd avatar Jun 10 '25 07:06 dz-fsd

Coverage Status

coverage: 71.089% (+0.004%) from 71.085% when pulling 0a1d4f871d4f1fc245e599e3623637a65593462d on dz-fsd:master into ccc68946e6a2a901f7f1592e77e322048a1566b9 on OSGeo:master.

coveralls avatar Jun 10 '25 09:06 coveralls

CC @szekerest @runette

rouault avatar Jun 10 '25 10:06 rouault

I am travelling for the next two days but can have a look after that ...

runette avatar Jun 10 '25 19:06 runette

I am reviewing it now

runette avatar Jun 17 '25 18:06 runette

hello , will this pr meged into next release?

gitlsl avatar Jul 07 '25 13:07 gitlsl

hello , will this pr meged into next release?

I'll be trying to review the UTF8 issues reported for the C# bindings and apply the necessary changes in the next few days.

szekerest avatar Jul 07 '25 16:07 szekerest

hello , will this pr meged into next release?

Sorry I didn't have time to apply the suggested changes. Please bear with me for a day or two :)

dz-fsd avatar Jul 08 '25 03:07 dz-fsd