?
Solved

PROBLEMS READING WITH TEXTFILES

Posted on 2003-11-16
5
Medium Priority
?
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 320 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

777 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