Search code examples
c#wpftextboxcopy-pasteansi

Paste contents to TextBox in ANSI Format


How can I make the textbox contents to ANSI format when paste in C#?


Solution

  • .NET uses Unicode for strings everywhere internally, including for the forms controls. So I think you're real question is, given a byte-array, how do I convert that byte-array into Unicode using a desired source encoding ("ANSI" of some flavor)?

    System.Text.Encoding has useful classes here.