HTMLWindow limits?

Hi,
I’m trying to write a simple email client using wxruby, and using
HTMLWindow to display the email contents. But HtmlWindow seems to have a
limit of 2362 bytes on the size of the page it would load - which I
found emperically by limiting the size of text i passed into the
control. Is this a known problem, or am I setting things wrongly?

Here’s the relevant piece of code:

class ItemDetail < Panel
  def initialize(parent,items,log)
    super(parent)
    @items=items
    @log=log

    @sizer = Wx::BoxSizer.new(Wx::VERTICAL)
      add_from
    add_message
    set_sizer(@sizer)
  end
  def add_from
    @from=TextCtrl.new(self,-1,"",:name=>"fromtxtctrl")
    @sizer.add(@from,1,Wx::ALL|Wx::GROW)
  end

  def add_message
    @message=HtmlWindow.new(self,:name=>"msghtmlwindow")
    @sizer.add(@message,10,Wx::ALL|Wx::GROW)
  end

  def setItem(index)
    begin
      item=@items[index]
      @from.set_value(item.from)
      #@message.set_value(item.body[0..2362]) #emperically found that
this is the limit for page size.
    rescue Exception => err
      @log.write_text('invalid item index: "%d, or err:%s"'
%[index,err.message])
    end
  end
end

Vk Dee wrote:
Correction: the set_value line is not commented out. It should read like
so:

  @message.set_value(item.body[0..2362]) #emperically found that

Vk Dee wrote:

I’m trying to write a simple email client using wxruby, and using
HTMLWindow to display the email contents. But HtmlWindow seems to have a
limit of 2362 bytes on the size of the page it would load - which I
found emperically by limiting the size of text i passed into the
control. Is this a known problem, or am I setting things wrongly?

No, there is no such limit on the size of text to be displayed.

Does this problem arise with a particular text, or any HTML text? I
would check whether the HTML string you are providing is correctly
encoded in UTF-8 - if not, you might get this kind of truncation at an
invalid byte.

Here’s the relevant piece of code:

Thanks for posting code, but it’s not possible to check it out unless
it’s self-contained and runnable. We can’t reconstruct and imagine what
the rest of the program is doing. Often you will find the process of
reducing it to a basic sample illustrating the problem will show up the
root cause.

a

No, there is no such limit on the size of text to be displayed.
ok

Thanks for posting code, but it’s not possible to check it out unless
it’s self-contained and runnable. We can’t reconstruct and imagine what
the rest of the program is doing. Often you will find the process of
reducing it to a basic sample illustrating the problem will show up the
root cause.

fair enough. i’ll try and put in a self-contained sample. and check out
the possibility of rogue html.
Thanks

Also, keep in mind that HTMLWindow is not a full blown Browser Engine,
like
what you would get with the Mozilla Engine, or IE’s ActiveX Control, or
even
WebKit. HTMLWindow can only handle a small subset of HTML Tags, and is
very
strict in what it will properly interpret. So make sure your not using
anything that’s above HTML 3.0 strict set. Or something along thoes
lines.

Update: it does look like a case of bad html.
Thanks for the quick response. I’ll update this thread if there’s
anything new to add.

fair enough. i’ll try and put in a self-contained sample. and check out
the possibility of rogue html.
Thanks

Vk Dee wrote:
Final update:
My fix in case anyone has the same problem was to replace all
non-printable characters like so:
htmlstring.gsub(/[^[:print:]]/, ‘’)

Update: it does look like a case of bad html.
Thanks for the quick response. I’ll update this thread if there’s
anything new to add.