473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Clipboard OEMText is confusing

If I open a Command Prompt window and with the Alt key enter 222 then 223
then 224 so the window shows ???

If I then copy that to the clipboard and in my program do

Case DataFormats.OemText
Dim bDataO As DataObject = Clipboard.GetDataObject()
If bDataO.GetDataPresent(DataFormats.OemText, False) Then
Editor1.Text = CType(bDataO.GetData(DataFormats.OemText, False), String)
End If

I get some symbol I don't know followed by a beta followed by an "a" with a
dot over it.

I'd expect to get the same symbols that show in the Command window.
I don't know why I expect that except that I thought the Command wondow was
like DOS and DOS used OEM?

I'd appreciate a few works of enlightment.

Would you expect to see what I see or what I expected to see?

Why?

Thanks in advance for any helpful rempl.
Nov 21 '05 #1
3 1677
" **Developer**" <RE*************@a-znet.com> schrieb:
If I open a Command Prompt window and with the Alt key enter 222 then 223
then 224 so the window shows ???

If I then copy that to the clipboard and in my program do

Case DataFormats.OemText
Dim bDataO As DataObject = Clipboard.GetDataObject()
If bDataO.GetDataPresent(DataFormats.OemText, False) Then
Editor1.Text = CType(bDataO.GetData(DataFormats.OemText, False), String)
End If

I get some symbol I don't know followed by a beta followed by an "a" with
a dot over it.

I'd expect to get the same symbols that show in the Command window.
I don't know why I expect that except that I thought the Command wondow
was like DOS and DOS used OEM?


Maybe an auto-conversion from DOS-OEM to Unicode is done and characters are
interpreted the wrong way. Untested:

\\\
Imports System.Globalization
Imports System.Text
..
..
..

''' <summary>
''' Konvertiert den Text in <paramref name="Text"/> von der DOS-
''' Codepage (OEM) in die Windows-Codepage (ANSI).
''' </summary>
''' <param name="Text">Text, der konvertiert werden soll.</param>
''' <returns>
''' Der Text aus <paramref name="Text"/> in der aktuellen Windows-
''' Codepage.
''' </returns>
Private Function ConvertFromOem(ByVal Text As String) As String
Return _
Encoding.GetEncoding( _
CultureInfo.InstalledUICulture.TextInfo.OEMCodePag e _
).GetString(Encoding.Default.GetBytes(Text))
End Function
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
>
Maybe an auto-conversion from DOS-OEM to Unicode is done and characters
are interpreted the wrong way. Untested:

Guess it's tested now - works for me - Thanks

This is what I tried but it didn't work.
Do you see what is wrong with it?
Called with 437

Public Shared Function GetCodePageString(ByVal str As String, ByVal codePage
As Integer) As String

Dim OutEncoding As Encoding = Encoding.GetEncoding(codePage)

Dim InEncoding As Encoding = Encoding.Unicode

Dim StrAsBytes As Byte() = InEncoding.GetBytes(str)

Dim OutEncodingBytes As Byte() = Encoding.Convert(InEncoding, OutEncoding,
StrAsBytes)

Dim OutEncodingChars(lOutEncoding.GetCharCount(OutEnco dingBytes, 0,
OutEncodingBytes.Length)) As Char

GetCodePageString = New String(OutEncodingChars)

End Function


Nov 21 '05 #3
I also interchanged the definition of OutEncoding and InEncoding
Still did not work
" **Developer**" <RE*************@a-znet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

Maybe an auto-conversion from DOS-OEM to Unicode is done and characters
are interpreted the wrong way. Untested:

Guess it's tested now - works for me - Thanks

This is what I tried but it didn't work.
Do you see what is wrong with it?
Called with 437

Public Shared Function GetCodePageString(ByVal str As String, ByVal
codePage As Integer) As String

Dim OutEncoding As Encoding = Encoding.GetEncoding(codePage)

Dim InEncoding As Encoding = Encoding.Unicode

Dim StrAsBytes As Byte() = InEncoding.GetBytes(str)

Dim OutEncodingBytes As Byte() = Encoding.Convert(InEncoding, OutEncoding,
StrAsBytes)

Dim OutEncodingChars(lOutEncoding.GetCharCount(OutEnco dingBytes, 0,
OutEncodingBytes.Length)) As Char

GetCodePageString = New String(OutEncodingChars)

End Function

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: xyz | last post by:
I have a menu item to handle clipboard actions (cut, copy, paste). When I paste text that I copied from a Hungarian web page, the display looks normal on my RichTextBox, but the text retrieved from...
8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
7
by: Newbie | last post by:
How do I clear the clipboard in VB.NET 2003? TIA Newbie
1
by: phreaktor | last post by:
Let me begin by saying I admire the knowledge of some of you forum-goers. I have only taken an introductory couse in Visual Basic.NET as a supplement to my study of Electronics Engineering. I have...
15
by: Peter Duniho | last post by:
I'm trying to use .NET and C# to draw a metafile copied to the clipboard by another application (Word 2003 in this case, but it shouldn't matter). I naively thought that I'd be able to use the...
1
by: Figmo | last post by:
Wow.....this is darned odd.... I have an app that integrates with other applications. It registers a global hotkey with Windows. When the hotkey executes it sends a CTRL-C to the active...
8
by: active | last post by:
Guess I'm looking for someone who likes to work difficult puzzles. I can't seem to ever retrieve a palette handle from the clipboard. Below is a simple test program that demonstrates the...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.