Skip to main content
btempleton1982
Inspiring
March 31, 2016
Question

Weird ai::UnicodeString behavior

  • March 31, 2016
  • 0 replies
  • 536 views

I'm having a strange error while using ai::UnicodeStrings.

I set up a couple ai::UnicodeStrings from text literals like:

ai::UnicodeString foo = ai::UnicodeString("This is some text.")

Later on, I try to convert back to a const char* like so:

const char* fooT = foo.as_Platform().c_str();

This works great on most of the strings, but then on one string, fooT winds up being gibberish. Rearranging the order of declarations and whatnot doesn't seem to change the behavior, it's always the same string that gets mangled converting back to a char*. I've been able to get it to work with that one string by shortening it a few characters. Make it a couple characters longer and it comes out mangled again.

Now, it's entirely possible that this is due to a memory management issue somewhere else that is corrupting something. I'm not perfect at working with memory yet. But I wanted to check here and see if anyone else has had any similar problems.

This topic has been closed for replies.