Solved

DOS-WINDOWS International Character Incompability

Posted on 1997-10-08
3
178 Views
Last Modified: 2010-04-04
I want to save some text including characters like 'ðüöçþÝ'
to be read from DOS's Edýt program. If I save the text directly international char5acters above are not shown.
Is there a way to save them directly from the Delphi program?
 One Solution may be that to sent the document to WordPad or Excel,Word and by using the 'save as' command save it in DOS compatible.
0
Comment
Question by:erkan
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 50 total points
ID: 1347090
Hi,

You have to convert the text from windows characterset to DOS characterset. You can do this in Delphi by using the Win32-function CharToOEM (older AnsiToOEM).

/pivar
0
 

Author Comment

by:erkan
ID: 1347091
Can you send me a working example?
0
 
LVL 22

Expert Comment

by:pivar
ID: 1347092
Hi,

Here is a simple example, where the function takes the (ANSI) text in a memo component and converts it to a DOS-text in pStr using the CharToOem function. Then it saves the text to the file 'test.txt', ready to be viewed in EDIT.

/pivar

procedure TForm1.Button1Click(Sender: TObject);
var
  fs: TFileStream;
  pStr: PChar;
begin
  pStr := StrAlloc(Length(memo1.text) + 1);
  CharToOem(PChar(memo1.text),pStr);
  fs := TFileStream.Create('test.txt',fmCreate);
  fs.write(pStr^,StrLen(pStr));
  fs.Free;
  StrDispose(pStr);
end;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question