[webkit-help] How can I write content of a TextRun to a file
n179911 at gmail.com
Sun Jan 17 15:03:25 PST 2010
I have looked at your ICU example. But i dont' quit understand what to do.
Should i call the function u_UCharsToChars() to convert TextRun int char*?
On Sun, Jan 17, 2010 at 12:23 PM, Julien Chaffraix
<julien.chaffraix at gmail.com> wrote:
>> I have a TextRun object and I would like to write the characters
>> between 'from' and 'to'
>> writeToFile(const TextRun& run, int from, int to)
>> Can you please tell me how can I do that?
>> I get a UChar* from run.characters() But how can I write it to a file?
> You can convert it to some encoding that you can dump as char* such as
> latin1 or utf8:
> String characters = run.characters().substring(from, to - from);
> CString charactersUTF8 = characters.utf8(); // Or .latin1().
> std::cout << charactersUTF8.data() << std::endl; // Print the results
> but you can use a stream to a file or fwrite as it as char*.
> If you want to avoid encoding conversion or the overhead of creating a
> String and a CString, you will have to look at the ICU documentation
> (though you could use the same magic as in
> to dump your UChar*).
More information about the webkit-help