Solved

PROBLEMS READING WITH TEXTFILES

Posted on 2003-11-16
5
276 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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