I developed an application using Maui. When opening a shapefile, it prompts with the error "Invalid argument: UTF8 contains invalid characters". After research, I found that there are field names in the shapefile that are in Chinese. How can I solve this problem? Is there a setting for encoding in ArcGIS Runtime?
Another strange thing is that the program runs normally under Windows, but it has this issue only on Android. I haven't tested it on iOS。
I have now added a cpg file and set the encoding corresponding to dbf. It runs normally in the Windows environment (if I modify the cpg code page to a different value, the same error will be reported when running in Windows), but the same problem still occurs in Android. It seems that when ArcGIS Runtime reads the shapefile in the Android environment, the cpf file does not work.
But both Windows and Android environments use the same ArcGIS runtime library, so there shouldn't be different results. That's weird.
Any chance you can share the shapefile causing this problem?
Thanks! I'll have a look. Btw how do you deploy and load the file onto your Android device? Android is quite different with how you deploy content with the application compared to other apps, so want to make sure this isn't the issue first.
Follow-up: I'm able to reproduce the issue and will have someone investigate.
Your data seems to be using codepage 936 which, according to wikipedia, is a legacy pre-unicode character encoding for Windows. I wonder if it's possible for you to author the shapefile with a codepage that Android and iOS understands (I was able to reproduce the issue on iOS too).
Yes, it's using codepage 936, I can't change it. Can't Android and iOS use this code page? Is there any way to make Android and iOS support codepage 936
I don't believe so, considering it's a Windows-specific and deprecated code page. I've logged an internal bug to investigate, but my gut feeling is you're running into an OS limitation.