Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-02

Please help with strings "dissappearing" - because of funny non-ascii chars

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reenen Laurie

Hi all,

I am at the end of my patience, and I have no clue what to do, and this project needed to have been done a week or so back.

When I execute attached program (*very* simple). And open file "example.csv" then my showmessage command doesn't display anything.

I am unsure if there is anything in the string, though I think it is.

Please help! How can I get that funny chars to display... even if I have to somehow replace them with an ascii counterpart.

Regards,
-Reenen

o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -- o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/048127c3/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: test.zip Type: application/zip Size: 1547 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/048127c3/attachment.zip

Reply by email

Luca Olivetti
to Reenen Laurie

En/na Reenen Laurie ha escrit:

Show quoted text 13 lines
Hi all, I am at the end of my patience, and I have no clue what to do, and this project needed to have been done a week or so back. When I execute attached program (*very* simple). And open file "example.csv" then my showmessage command doesn't display anything. I am unsure if there is anything in the string, though I think it is. Please help! How can I get that funny chars to display... even if I have to somehow replace them with an ascii counterpart.

The LCL only works with utf8, while your file appears to be cp1250. You have to either convert the file to utf8 before opening it or convert it while you read it.
BTW, under linux I see the funny characters, though they're not what they should be. I don't know it if is because I'm trying with a snapshot of 0.9.26.1 or because the linux interface is more tolerant with malformed strings than the windows one.

Bye

Luca

Reply by email

Reenen Laurie
to Luca Olivetti

Luca said:
You have to either convert the file to utf8 before opening it or convert it while you read it.

How do I convert it? What I've tried is:
* Open the badly formatted file in the Lazarus IDE, then copied the "funny" chars into the following code:
* s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]);
* s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]);

But that also doesn't work...

Sigh...

Regards,
-Reenen

Luca Olivetti wrote 31 lines
En/na Reenen Laurie ha escrit: > > Hi all, > > I am at the end of my patience, and I have no clue what to do, and this > project needed to have been done a week or so back. > > When I execute attached program (*very* simple). And open file > "example.csv" then my showmessage command doesn't display anything. > > I am unsure if there is anything in the string, though I think it is. > > Please help! How can I get that funny chars to display... even if I have > to somehow replace them with an ascii counterpart. The LCL only works with utf8, while your file appears to be cp1250. You have to either convert the file to utf8 before opening it or convert it while you read it. BTW, under linux I see the funny characters, though they're not what they should be. I don't know it if is because I'm trying with a snapshot of 0.9.26.1 or because the linux interface is more tolerant with malformed strings than the windows one. Bye -- Luca _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/e78fb43e/attachment.html

Reply by email

Reenen Laurie
to Reenen Laurie

Ermmm...

Seems like google has something to "clean" those chars from it. When I tried to post it, I had the weird character in there...

Reenen Laurie wrote 63 lines
Luca said: You have to either convert the file to utf8 before opening it or convert it while you read it. How do I convert it? What I've tried is: * Open the badly formatted file in the Lazarus IDE, then copied the "funny" chars into the following code: * s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]); * s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]); But that also doesn't work... Sigh... Regards, -Reenen On Sun, Feb 22, 2009 at 4:36 PM, Luca Olivetti wrote: > En/na Reenen Laurie ha escrit: > > > > Hi all, > > > > I am at the end of my patience, and I have no clue what to do, and this > > project needed to have been done a week or so back. > > > > When I execute attached program (*very* simple). And open file > > "example.csv" then my showmessage command doesn't display anything. > > > > I am unsure if there is anything in the string, though I think it is. > > > > Please help! How can I get that funny chars to display... even if I have > > to somehow replace them with an ascii counterpart. > > The LCL only works with utf8, while your file appears to be cp1250. > You have to either convert the file to utf8 before opening it or convert > it while you read it. > BTW, under linux I see the funny characters, though they're not what > they should be. I don't know it if is because I'm trying with a snapshot > of 0.9.26.1 or because the linux interface is more tolerant with > malformed strings than the windows one. > > Bye > -- > Luca > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > -- o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions.
o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/4a811ee5/attachment.html

Reply by email

Reenen Laurie
to Reenen Laurie

This solution worked...

 s := stringReplace(s,chr(148),'"',[rfReplaceAll, rfIgnoreCase]);
 s := stringReplace(s,chr(147),'"',[rfReplaceAll, rfIgnoreCase]);
 s := stringReplace(s,chr(150),'--',[rfReplaceAll, rfIgnoreCase]);
 s := stringReplace(s,chr(146),'''',[rfReplaceAll, rfIgnoreCase]);

However this car is also giving me issues: ?
There is not "equivalent"... only e...
Or is that ? and alt 130 (?) different?

But this must be a problem that's happened a lot before? Not so?

Reenen Laurie wrote 83 lines
Ermmm... Seems like google has something to "clean" those chars from it. When I tried to post it, I had the weird character in there... On Sun, Feb 22, 2009 at 5:19 PM, Reenen Laurie wrote: > Luca said: > You have to either convert the file to utf8 before opening it or convert > it while you read it. > > How do I convert it? What I've tried is: > * Open the badly formatted file in the Lazarus IDE, then copied the > "funny" chars into the following code: > * s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]); > * s := stringReplace(s,'"','""',[rfReplaceAll, rfIgnoreCase]); > > But that also doesn't work... > > Sigh... > > Regards, > -Reenen > > > > On Sun, Feb 22, 2009 at 4:36 PM, Luca Olivetti wrote: > >> En/na Reenen Laurie ha escrit: >> > >> > Hi all, >> > >> > I am at the end of my patience, and I have no clue what to do, and this >> > project needed to have been done a week or so back. >> > >> > When I execute attached program (*very* simple). And open file >> > "example.csv" then my showmessage command doesn't display anything. >> > >> > I am unsure if there is anything in the string, though I think it is. >> > >> > Please help! How can I get that funny chars to display... even if I >> have >> > to somehow replace them with an ascii counterpart. >> >> The LCL only works with utf8, while your file appears to be cp1250. >> You have to either convert the file to utf8 before opening it or convert >> it while you read it. >> BTW, under linux I see the funny characters, though they're not what >> they should be. I don't know it if is because I'm trying with a snapshot >> of 0.9.26.1 or because the linux interface is more tolerant with >> malformed strings than the windows one. >> >> Bye >> -- >> Luca >> _______________________________________________ >> Lazarus mailing list >> >> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >> > > > > -- > o__ > ,_.>/ _ > (_)_\(_)_______ > ...speed is good > _______________ > I believe five out of four people have a problem with fractions. > -- o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions.
o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/3e66474b/attachment-0001.html

Reply by email

Mattias Gaertner
to Reenen Laurie
Show quoted text 12 lines
This solution worked... s := stringReplace(s,chr(148),'"',[rfReplaceAll, rfIgnoreCase]); s := stringReplace(s,chr(147),'"',[rfReplaceAll, rfIgnoreCase]); s := stringReplace(s,chr(150),'--',[rfReplaceAll, rfIgnoreCase]); s := stringReplace(s,chr(146),'''',[rfReplaceAll, rfIgnoreCase]); However this car is also giving me issues: ? There is not "equivalent"... only e... Or is that ? and alt 130 (?) different? But this must be a problem that's happened a lot before? Not so?

The LCL unit lconvencoding contains a function to convert CP1250 to UTF8:
CP1250ToUTF8

Mattias

Reply by email

Reenen Laurie
to Mattias Gaertner

Thank you!

On Sun, Feb 22, 2009 at 7:56 PM, Mattias Gaertner <

Show quoted text 30 lines
wrote: On Sun, 22 Feb 2009 17:49:01 +0200 Reenen Laurie wrote: > This solution worked... > > s := stringReplace(s,chr(148),'"',[rfReplaceAll, rfIgnoreCase]); > s := stringReplace(s,chr(147),'"',[rfReplaceAll, rfIgnoreCase]); > s := stringReplace(s,chr(150),'--',[rfReplaceAll, rfIgnoreCase]); > s := stringReplace(s,chr(146),'''',[rfReplaceAll, rfIgnoreCase]); > > However this car is also giving me issues: ? > There is not "equivalent"... only e... > Or is that ? and alt 130 (?) different? > > But this must be a problem that's happened a lot before? Not so? The LCL unit lconvencoding contains a function to convert CP1250 to UTF8: CP1250ToUTF8 Mattias _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
o__ ,_.>/ _ (_)_\(_)_______ ...speed is good _______________ I believe five out of four people have a problem with fractions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090222/b4167a7e/attachment.html

Reply by email