Under linux, is there some c++ API which can output string of type nsEmbedString to file? So that I don't need the conversion when I use "fputws"?
In the cxc book, nsEmbedString and nsEmbedCString are mentioned. In the string-guide document, it mentions that "nsString or nsSharableString for member variables". But in the mozilla source code, nsString is under "/xpcom/string/obsolete" directory. So if I need some string variable to feed into some interface method to get return value of type of nsAString, which string type I should choose to declare string variable? thanks! "Benjamin D. Smedberg" <[EMAIL PROTECTED]> wrote news:[EMAIL PROTECTED] > Unfortunately, there is not a way to to UTF16->UTF8 conversions without > linking to non-frozen stuff (yet). Darin and I are trying to figure out > the minimum necessary linkage to accomplish these kinds of tasks. > > You can't cast PRUnichar* to wchar_t* because on most *ixes, wchar_t is > a four-byte type. However, you can safely do a funky copy-conversion to > a wchar_t type: > > PRUnichar *start = nsStr.get(); > PRUnichar *end nsStr.get() + nsStr.Length(); > wchar_t *wstart = new wchar_t[nsStr.Length()]; > wchar_t *wend = start + nsStr.Length(); > > for(; start < end; ++start) { > *wstart = (wchar_t) *start; > ++wstart; > } > *wstart = 0; > > There are also some interfaces in intl (charset conversion) that might > do the trick for you. > > --BDS _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
