Select to view content in your preferred language

Invalid argument: UTF8 contains invalid characters

332
9
a month ago
Labels (3)
happygis
Emerging Contributor

     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。

0 Kudos
9 Replies
happygis
Emerging Contributor

   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. 

0 Kudos
dotMorten_esri
Esri Notable Contributor

Any chance you can share the shapefile causing this problem?

0 Kudos
happygis
Emerging Contributor

test.zip is the shapefile data.  It seems that when ArcGIS Runtime reads the shapefile in the Android environment, the cpf file does not work.

0 Kudos
dotMorten_esri
Esri Notable Contributor

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.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Follow-up: I'm able to reproduce the issue and will have someone investigate.

0 Kudos
dotMorten_esri
Esri Notable Contributor

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

0 Kudos
happygis
Emerging Contributor

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

0 Kudos
dotMorten_esri
Esri Notable Contributor

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.

0 Kudos
happygis
Emerging Contributor

test.zip is the shape file data.

0 Kudos