Skip to content

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

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

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

dz-fsd
Copy link
Contributor

@dz-fsd dz-fsd commented Jun 10, 2025

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

@coveralls
Copy link
Collaborator

coveralls commented Jun 10, 2025

Coverage Status

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

@rouault
Copy link
Member

rouault commented Jun 10, 2025

CC @szekerest @runette

@runette
Copy link
Contributor

runette commented Jun 10, 2025

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

@runette
Copy link
Contributor

runette commented Jun 17, 2025

I am reviewing it now

Copy link
Contributor

@szekerest szekerest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the code seems solid. Thanks for your effort!

@gitlsl
Copy link

gitlsl commented Jul 7, 2025

hello , will this pr meged into next release?

@szekerest
Copy link
Contributor

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.

@dz-fsd
Copy link
Contributor Author

dz-fsd commented Jul 8, 2025

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 :)

Denis Zibarev added 2 commits July 8, 2025 12:06
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.
@rouault rouault added this to the 3.12.0 milestone Jul 9, 2025
@rouault rouault merged commit a9d1885 into OSGeo:master Jul 9, 2025
38 checks passed
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

Successfully merging this pull request may close these issues.

6 participants