Solved

DOS-WINDOWS International Character Incompability

Posted on 1997-10-08
3
157 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now