[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

problem about read .txt file

Pat Kiatchaipipat

11/26/2007 10:11:00 AM

I have read text by this code

message = ""

file = File.new(fileDirectory , "r")
while line = file.gets
message = message+line
end
file.close
puts message
@textbox1.set_value(message)

fileDirectory is a path of text file
@textbox1 is textctrl that I want to show text in that file

and I have problem, it can only read text file with Encoding UTF-8, it
can't read from ANSI to show in textctrl (@textbox1) but

puts message

can show message normally with encode UTF-8 and ANSI

now I have problem how I can show text with encode ANSI in @textbox1??
:'(
--
Posted via http://www.ruby-....

13 Answers

Alex Young

11/26/2007 10:30:00 AM

0

Pat Kiatchaipipat wrote:
> I have read text by this code
>
> message = ""
>
> file = File.new(fileDirectory , "r")
> while line = file.gets
> message = message+line
> end
> file.close
> puts message
> @textbox1.set_value(message)
>
> fileDirectory is a path of text file
> @textbox1 is textctrl that I want to show text in that file
>
> and I have problem, it can only read text file with Encoding UTF-8, it
> can't read from ANSI to show in textctrl (@textbox1) but
>
> puts message
>
> can show message normally with encode UTF-8 and ANSI
>
> now I have problem how I can show text with encode ANSI in @textbox1??

That sounds toolkit-specific. What GUI library are you using?

--
Alex

Pat Kiatchaipipat

11/26/2007 10:38:00 AM

0

Alex Young wrote:
> Pat Kiatchaipipat wrote:
>> @textbox1.set_value(message)
>>
>> now I have problem how I can show text with encode ANSI in @textbox1??
>
> That sounds toolkit-specific. What GUI library are you using?

I use wxruby :)
--
Posted via http://www.ruby-....

Alex Young

11/26/2007 10:44:00 AM

0

Pat Kiatchaipipat wrote:
> Alex Young wrote:
>> Pat Kiatchaipipat wrote:
>>> @textbox1.set_value(message)
>>>
>>> now I have problem how I can show text with encode ANSI in @textbox1??
>> That sounds toolkit-specific. What GUI library are you using?
>
> I use wxruby :)
I don't know anything specific about WxRuby, but have you looked at
using iconv?

--
Alex

Phrogz

11/26/2007 2:36:00 PM

0

On Nov 26, 3:10 am, Pat Kiatchaipipat <l3lit...@hotmail.com> wrote:
> I have read text by this code
>
> message = ""
>
> file = File.new(fileDirectory , "r")
> while line = file.gets
> message = message+line
> end
> file.close
> puts message
> @textbox1.set_value(message)

How is the above different or better than:
message = IO.read( fileDirectory )
?

Ubiquitous

11/3/2013 6:41:00 PM

0

et472@ncf.ca wrote:
>On Sun, 3 Nov 2013, Ubiquitous wrote:

>> And you posted this off-topic article here because?
>
>He thinks Hooter Girls are from Hootersville? Like the three sisters in
>the water tank, and Mrs. Douglas and one of the handymen?

I think Petticoat Junction took place in Pixly, not Hooterville.

--
Q: Why is ObamaCare like a turd?
A: You have to pass it to see what's in it.

Anim8rFSK

11/3/2013 6:53:00 PM

0

In article <alpine.LNX.2.02.1311031212570.25510@darkstar.example.org>,
Michael Black <et472@ncf.ca> wrote:

> On Sun, 3 Nov 2013, Ubiquitous wrote:
>
> > lowes@msn.com wrote:
> >
> >> HOOTER GIRLS-CHEERLEADERS-SPORTS-ECT........
> >
> > And you posted this off-topic article here because?
> >
> He thinks Hooter Girls are from Hootersville? Like the three sisters in
> the water tank, and Mrs. Douglas and one of the handymen?

And Kate.

And Dog.

And the Lady M.D. (she's as pretty as can be).

And technically there are ... what ... 6 sisters?

--
Wait - are you saying that ClodReamer was wrong, or lying?

super70s

11/3/2013 7:54:00 PM

0

In article <alpine.LNX.2.02.1311031212570.25510@darkstar.example.org>,
Michael Black <et472@ncf.ca> wrote:

> On Sun, 3 Nov 2013, Ubiquitous wrote:
>
> > lowes@msn.com wrote:
> >
> >> HOOTER GIRLS-CHEERLEADERS-SPORTS-ECT........
> >
> > And you posted this off-topic article here because?
> >
> He thinks Hooter Girls are from Hootersville? Like the three sisters in
> the water tank, and Mrs. Douglas and one of the handymen?

Mrs. Douglas' mispronunciation of "Hooterville" as "Hootersville" would
have been hilarious if I hadn't been so young at the time.

Pixly rings a bell but according to the Complete Directory of Prime Time
TV Shows Petticoat Junction was set in Hooterville.

I think Pixly was to Hooterville as Mt. Pilot was to Mayberry in the
Andy Griffith Show.

Michael Black

11/3/2013 8:49:00 PM

0

Anim8rFSK

11/3/2013 9:34:00 PM

0

In article <l565cg$mul$5@dont-email.me>,
Ubiquitous <weberm@polaris.net> wrote:

> et472@ncf.ca wrote:
> >On Sun, 3 Nov 2013, Ubiquitous wrote:
>
> >> And you posted this off-topic article here because?
> >
> >He thinks Hooter Girls are from Hootersville? Like the three sisters in
> >the water tank, and Mrs. Douglas and one of the handymen?
>
> I think Petticoat Junction took place in Pixly, not Hooterville.

Sorry, neither. Pixly is the next bigger town, the equivalent of
Mayberry's Mount Pilot. Hooterville is the very small town where Sam
Drucker's store is. Petticoat Junction is the wide spot in the tracks
where the Shady Rest Hotel is located. But this raises an interesting
point - I'm not sure that Petticoat Junction is anything but the name of
the show. I don't recall anybody ever using the words "Petticoat
Junction" in dialog. We know Hooterville only has something like 40
people in it, but we have no idea how big it is; it could be a large
area encompassing all the farms we see in Green Acres, as well as the
Shady Rest, and still only have 40 people.

--
Wait - are you saying that ClodReamer was wrong, or lying?

Ubiquitous

11/4/2013 4:19:00 PM

0

anim8rfsk@cox.net wrote:
> Ubiquitous <weberm@polaris.net> wrote:
>> et472@ncf.ca wrote:

>>>He thinks Hooter Girls are from Hootersville? Like the three sisters
>>>in the water tank, and Mrs. Douglas and one of the handymen?
>>
>> I think Petticoat Junction took place in Pixly, not Hooterville.
>
>Sorry, neither. Pixly is the next bigger town, the equivalent of
>Mayberry's Mount Pilot. Hooterville is the very small town where Sam
>Drucker's store is. Petticoat Junction is the wide spot in the tracks
>where the Shady Rest Hotel is located. But this raises an interesting
>point - I'm not sure that Petticoat Junction is anything but the name of
>the show. I don't recall anybody ever using the words "Petticoat
>Junction" in dialog. We know Hooterville only has something like 40
>people in it, but we have no idea how big it is; it could be a large
>area encompassing all the farms we see in Green Acres, as well as the
>Shady Rest, and still only have 40 people.

I always wondered about the origin of the name and figured it was because
of the three sisters skinny-dipping in the watertower who hung their
petticoats over the side.

--
Q: Why is ObamaCare like a turd?
A: You have to pass it to see what's in it.