[webkit-help] How can I write content of a TextRun to a file

Julien Chaffraix julien.chaffraix at gmail.com
Wed Jan 20 21:49:28 PST 2010


> I followed your example by doing this:
> String characters = String(run.characters()).substring(from, to - from);
> CString characters = characters.latin1();
> printf ("(%s)\n",characters.data());
>
> But it has problem where there is entity reference in the TextRun,
> e.g. "‎1 hour ago‎"
>
> The above code will print "?1 hour ago?"

WebKit replaces entities and quotes can be represented by a char* so I
really don't know what happens here. Note that you will have the same
issue with any characters that is not representable on a single char*.

> But when I do 'inspect element', the browser just shows "1 hour ago".

There is no conversion involved here so that's why there is no issue.

> My question is how can the browser skips this entity reference
> character for string like "‎1 hour ago‎"

You could try to detect characters that cannot be represented as char*
(basically non ascii chars) and avoid printing them. This is far from
being perfect. There may be some way of printing them directly but I
don't know it.

Regards,
Julien


More information about the webkit-help mailing list