Solved

PROBLEMS READING WITH TEXTFILES

Posted on 2003-11-16
5
274 Views
Last Modified: 2010-04-05
Dear All,

Always I am reading textfiles with texts written in Spanish, Portuguese or French and display them in a memo or listbox I have problems with characters with accents, such as ´á´, ´é´, ´ã´.


Please, do you know as I solve this problem?


Thanks

dict
0
Comment
Question by:dict
  • 2
  • 2
5 Comments
 

Expert Comment

by:Smortex
ID: 9759737
How do you read your files ?
What is displayed instead of characters with accents ?
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 9759750
Yes, you must use the OemToChar function:

var
str1,str2:Pchar;
OemToChar(str1,str2);

str1 is the string to convert, and str2 ist the converted string.

Best Regards.
Marcos.
0
 

Author Comment

by:dict
ID: 9819622
Dear marcoszorrilla,

Sorry by my delay in reply you.

Please, how I apply OemToChar(str1,str2); in a listbox?

I am increasing points to 80.

dict
0
 
LVL 3

Accepted Solution

by:
marcoszorrilla earned 80 total points
ID: 9839922
procedure TForm1.Button1Click(Sender: TObject);
Try this example:

var
str2:Pchar;
nCont:Integer;
begin
nCont:=0;
listbox1.Items.LoadFromFile('D:\Prueba.txt');


  For nCont:=0 to (Listbox1.Items.Count -1) do
  begin
  OemToChar(PChar(Listbox1.Items[nCont]),str2);
  Listbox1.Items[nCont]:=str2;
  ShowMessage(str2);//Only for test.
  end;

end;

Best Regards
Marcos.
0
 

Author Comment

by:dict
ID: 9840205
Thank you very much.

I had a code which used a procedure for each change of characters. Now it is will be possible using only a procedure. Great!


Best regards,

dict
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

911 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

21 Experts available now in Live!

Get 1:1 Help Now