Re: nsString

Benjamin Smedberg <[email protected]> Tue, 29 Nov 2011 10:47:48 -0500
Newsgroups gmane.comp.mozilla.devel.embedding
Message-ID <[email protected]>
On 11/28/2011 5:36 AM, philippe wrote:
> Hello.
>
> I built a browser with gecko 1.8 . It worked fine.
> Now I try to use gecko 1.9.2.23. I get some conversions problems
>
> For example:
>
> ______________
>
> nsString attributeName
>
> char* attrName=ToNewCString(attributeName); causes an error : cannot
> convert parameter 1 from 'nsString_external' to 'const nsACString&'
> ___________________
>
> Is there a doc about such conversions in 1.9.2.
The "ToNewCString" version which took a wide string "in" and produced a 
narrow string "out" didn't have an identified character set, and so was 
removed at some point along the way. Assuming you want a UTF8 narrow 
string allocated, you'd need something like:

ToNewCString(NS_ConvertUTF16toUTF8(attributeName));

--BDS