More testing left me wondering about this problem, increasing the memory
stopped the error in one part of the code, as well as crashing the page,
but then it popped up in another part, and adding:
Wt::WString::fromUTF8() as you suggested fixed that, as ~
bottomPage =  new Wt::WText(Wt::WString::fromUTF8("<div id='vpagebottom'
class='vpagebottom' style='width:" + playVideo->pagebottomwidth +
";height:" + playVideo->pagebottomheight + ";'>" + playVideo->pagebottom
+ "</div>"), Wt::XHTMLUnsafeText
the pageBottom is just html, and once it gets bigger then 50,000 it pops
up as an error message without doing a fromUTF8, 
but ok before some limit like 45,119, but I get the message at 53,795,
in some code, as I said, 
adding it to the database I did not have to do this once I added more
memory, 
in fact I switched back to using string, after the upgrade,
so this message is generated by Wt in an out of memory limit is hit (not
sure if that is on purpose, in fact, I thought it might just be that
programs on low memory start to do strange things), 
or by strings that are too large,
so its clear I need to monitor the size of the string, but what size is
too big?

Is there a limit on the size a string (string::max_size) can be in Wt
library?

I never did loose any data, regardless of the message, after the memory
upgrade that is, before it crashed the page, but doing this trick got
rid of the message, 
so my question is, is this the best way to deal with strings that get up
to lets say 50,000 to 100,000 or more?

Basically I read in the html from an xml file, store it in a database (1
time only, or on updates), then get it using dbo, create a WText widget
then bind it to a template.

The Problem is that web pages can get long if you let them, so I need to
figure out how long I can let them get, any idea how to combat this
issue?

Thanks

On Fri, 2014-07-11 at 16:19 +0200, Stefan Ruppert wrote:

> Hi,
> 
> from my experience this is mostly a character encoding problem. I
> noticed these errors by not using WString::fromUTF8() or if you use
> latin1 strings as plain UTF8 strings.
> 
> Within our projects all source code uses UTF8 encoding:
> 
> WString s = "Müller"; // will issue such an error
> WString s = WString::fromUTF8("Müller"); // is save
> 
> See also WString::setDefaultEncoding().
> 
> Regards,
> Stefan
> 
> Am 10.07.2014 23:20, schrieb Jeffrey Scott Flesher Gmail:
> > I am reading in from an XML file, a very long string of HTML using RAPIDXML:
> > std::string mypagebottom(nodeAttrib->value(), nodeAttrib->value_size());
> > then I write it to the database:
> > videoDb->pagebottom = mypagebottom;
> > and even
> > videoDb->pagebottom = mypagebottom.c_str();
> > Originally I was using all strings, but tried to fix it by defining them
> > as WString:
> > Wt::WString pagebottom;
> > Wt::Dbo::field(a, pagebottom,       "pagebottom");
> > 
> > It seems to have written the data, is this a problem that I can fix, if
> > so how?
> > 
> > I do not see an overloaded WString function that takes value and size
> > like string does,
> > is there a better way to write this that will avoid this message?
> > 
> > Thanks
> > 
> > 
> > ------------------------------------------------------------------------------
> > Open source business process management suite built on Java and Eclipse
> > Turn processes into business applications with Bonita BPM Community Edition
> > Quickly connect people, data, and systems into organized workflows
> > Winner of BOSSIE, CODIE, OW2 and Gartner awards
> > http://p.sf.net/sfu/Bonitasoft
> > 
> > 
> > 
> > _______________________________________________
> > witty-interest mailing list
> > witty-interest@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/witty-interest
> > 
> 
> 
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to