By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,163 Members | 1,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,163 IT Pros & Developers. It's quick & easy.

Can't decode Unicode to OEM

P: n/a
I copy some text from a DOS window to the clipboard

Then run this

But both messageboxes show the same (incorrect) symbols

Incorrect in that they do not agree with what shows in DOS

See anything wrong???

Dim bDataO As DataObject = Clipboard.GetDataObject()

If bDataO.GetDataPresent(DataFormats.OemText, False) Then

Dim str As String = CType(bDataO.GetData(DataFormats.OemText, False),


Dim lOutEncoding As Encoding = Encoding.GetEncoding(437)

Dim linEncoding As Encoding = Encoding.Unicode

Dim lStrAsBytes As Byte() = linEncoding.GetBytes(str)

Dim lOutEncodingBytes As Byte() = Encoding.Convert(linEncoding,
lOutEncoding, lStrAsBytes)

Dim lOutEncodingChars() As Char = lOutEncoding.GetChars(lOutEncodingBytes)

GetCodePageString = New String(lOutEncodingChars)

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.