You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by "K.Misha" <mi...@4k.com.ua> on 2013/09/24 19:07:59 UTC
convert OUString to char *
I have this code, made with your example:
char * getWText( char * text )
{
Reference < XTextDocument > xTextDocument
(xWriterComponent,UNO_QUERY);
Reference< XText > xText = xTextDocument->getText();
rtl::OUString uText = xText->getString();
rtl::OString str = rtl::OUStringToOString( uText,
RTL_TEXTENCODING_UTF8 );
char * str1 = (char *)str.getStr();
return str1;
}
This is original file:
And this is my return str1:
What i'm doing wrong? =(
Re: convert OUString to char *
Posted by Ariel Constenla-Haile <ar...@apache.org>.
On Tue, Sep 24, 2013 at 08:07:59PM +0300, K.Misha wrote:
> This is original file:
>
>
>
>
>
> And this is my return str1:
>
>
I see only empty lines here, no text, so I don't get what the difference
could be. But are you watching the value of str1 inside the debugger, or
just printing that to a console?
The code attached has non-ASCII characters, it prints the string
returned by OString::getStr() in the standard output; it "works" (all
characters are displayed) fine on Linux, but on Windows you may have to
do system specific stuff (didn't try it right now).
Regards
--
Ariel Constenla-Haile
La Plata, Argentina