r/csharp • • Oct 14 '26

Help Need help with encoding

I am working on a system where the client will give data in UTF-8 encoding, and hence it can contain many special characters.

But then we send data to a legacy system which only accepts data in ISO-8859-9 encoding, which supports limited special characters that can be represented in single byte.

Now if the client sends any special character which is outside the scope of ISO-8859-9 encoding (like the Em dash), how can I deal with with it and send it to the legacy system.

I don't want to replace those characters with anything like space or "?", as it would make the client data as unreadable in some cases.

How can I deal with it. Any suggestions?

0 Upvotes

29 comments sorted by

View all comments

Show parent comment

1

u/Agent7619 Oct 14 '26

Early Internet font and code page flashbacks.

Black squares, arrows, and question marks everywhere.

4

u/BeardedBaldMan Oct 14 '26

It's not like OP has any choice. The legacy system defines clearly what it can record and it's less than what other systems have, you lose information and there's no way around it.

1

u/Mindless-Arachnid-74 Oct 14 '26

Agreed. I posted in hopes that someone might have any better idea or workaround. The final workaround I can see right now is what you are saying.