Replace accents by the letter without accent

I’m trying the soluctions proposed in some posts using:

System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding(“ISO-8859-2”).GetBytes(CurrentElement_Label))

I’ve tried with some ISO codes and also with 1252, “1252”, Windows-1252 and “Windows-1252”.

But I always have the error: “System.ArgumentException: ‘1252’ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ‘name’) at System.Text.EncodingTable.InternalGetCodePageFromName(String name)”

I tried downloading all the Microsoft packages about Encoding but I still have the same issue in StudioX.

The error message indicates that the provided encoding name is not recognized. To resolve this issue, you can use the correct encoding name, which should be “windows-1252” instead of “1252.” Here’s how you can use it:

System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding("windows-1252").GetBytes(CurrentElement_Label))

@Airun

Try with this

utf8String = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding(“ISO-8859-2”).GetBytes(inputString));

@Airun

2.11 Unsupported specific character encoding

And the handling:

1 Like

That indicates “Windows-1252” is not a supported encoding name, it might be due to the .NET Framework version in use. Prior to .NET Framework 4.5, “Windows-1252” was not a recognized encoding name.

If you’re working with an older version of .NET Framework, you can use “windows-1252” (all lowercase) as the encoding name.

Here’s the code:

System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding("windows-1252").GetBytes(CurrentElement_Label))

@Airun

Making a mix between your post “Replace accents with normal letters - #3 by ppr” and this current post, I’ve finally been able to obtain the expected results, all accents are removed correctly!!! :star_struck: :partying_face:

But I face now a new issue more complex. I found that I need to keep the ñ :woozy_face:
Do you think there is any way to do it without becoming mad? :sweat_smile:

I’m really surprised about this behavior, in my company we are using Office365, I’m trying to pass employees from a booked service in Microsoft Bookings to a channel in Teams. For the main channel it worked perfectly with the mail address, but for sub-channel, the mail address are not found I don’t know why…so I decided to use the names. But some of the names contains accents (as í Á ü…) and also the spanish letter ñ. In the Bookings service list, the names appear with accents and everything, but, when searching them in Teams we must search them without accents but keeping the letter ñ… :exploding_head:

In Bookings Service with accents and with ñ:

In Teams without accent and without ñ:
image

In Teams without accent and WITH ñ:
image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.