Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No data available for encoding 1252 - Xamarin

Tags:

c#

xamarin

I am using Xamarin to develop an Android app, while trying to convert text to byte[] I get the following error:

no data is available for encoding 1252

My code:

byte[] mybyteA= Portable.Text.Encoding.UTF8.GetBytes(mystring);

Mono.Security.Cryptography.SHA224Managed sha22 = new _Mono.Security.Cryptography.SHA224Managed();
byte[] hash = sha22.ComputeHash(mybyteA);
like image 315
Dwight Avatar asked Jun 12 '16 21:06

Dwight


2 Answers

The Western Code page (1252) isn't being bundled into your final IPA/APK.

For iOS projects, include it by checking west under Project Properties -> iOS Build -> Internationalization:

enter image description here

For Android projects, include it by checking west under Project Properties -> Android Build -> Linker -> Internationalization:

enter image description here

like image 113
matthewrdev Avatar answered Nov 14 '22 13:11

matthewrdev


In Visual Studio, you must go to the properties window of each project:

iOS

You must scroll down until 'west'

enter image description here

Android enter image description here

like image 12
Diomedes Domínguez Avatar answered Nov 14 '22 14:11

Diomedes Domínguez