Oem2Ansi Function (String) | |
Convert a string of OEM characters to ANSI characters.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION Oem2Ansi(
cOemString AS STRING
) AS STRING
public static string Oem2Ansi(
string cOemString
)
Request Example
View SourceParameters
- cOemString
- Type: String
A source string of OEM characters.
Return Value
Type:
String
A converted string of ANSI characters.
Remarks
Oem2Ansi() converts the individual characters in the source string to matching characters from the ANSI character set.
This may need to be done because certain symbols, such as ß, have different code values in the ANSI and OEM character sets.
Therefore, when using Windows to read or display DOS string data or file names, it is often necessary to translate characters from OEM to ANSI.
Note that most X# for Clipper applications automatically perform an OEM to ANSI conversion when SetAnsi() is FALSE. Some, however, such as FRead(), that assume they are working with binary data, do not do such a conversion.
Remarks Caution |
---|
The Ansi2Oem() and Oem2Ansi() family of functions are compatibility functions. Do not use them unless you really have to.
X# is a Unicode language and conversions from Unicode - Ansi - Oem - Unicode will take place
if you use these functions.
You should also realize that Ansi2Oem(Oem2Ansi(cSource)) will not always return cSource. Some characters may
not be available in the OEM codepage and could be translated to other characters.
For example: Windows codepage 1252 has Capital E Umlaut (Ë) on position 203.
When translated to OEM codepage 437 this will become capital E without umlaut (69). Converting back to Ansi
this will remain a E without umlaut.
|
Examples
This example uses Oem2Ansi() to convert OEM characters to ANSI characters in order to read a DOS file into Windows:
1SetAnsi(TRUE)
2
3Oem2Ansi(FReadLine(ptrFileHandle))
4
See Also Reference
[M:Oem2AnsiBuff]