SbString constructor for wide character pointers

Create issue
Issue #68 resolved
Thomas Moeller created an issue

Starting with version 4 Coin3D uses UTF8 encoded strings. However, there is no method exposed by the SbString class that encodes a wide character string to UTF8. Also the included utility function cc_string_utf8_encode() only converts single characters and does not handle platform specific encoding of wide character strings (Linux: utf32, Windows: utf16).

In my opinion it would be very useful if the SbString class accepts also wide character strings, taking care of the conversion to UTF8. Please comment on this proposal. Would it be safe to assume that all targeted compilers support the wchar_t type now? I could implement this functionality if there are no concerns.

Comments (5)

  1. Roy Walmsley

    Thomas,

    Yes, I think that would be a good idea. But, before you embark on it, be sure to consider the downstream usage. After all, SbString is widespread in Coin.

    Roy

  2. Thomas Moeller reporter

    Roy, Thank you for commenting on this issue. Yes, I share your concerns regarding changes to the widely used SbString class. Because it is so central I tried to find out what the response of the other users would be. But so far not much objection or support.

    I implemented the proposed extension and created pull request #15 for it. I pretty much tried to follow the approach taken so far (even though I'm not a big fan of the style in string.cpp). No new include statements have been added to the header files, which I fear could impact other components possibly even outside of Coin itself, such as SoQt.

    Please let me know what you (or maybe others?) think.

    Best, Thomas

  3. Log in to comment