Advertisement

Version changes on 16bit string structures?

Started by August 14, 2014 08:58 AM
2 comments, last by Zervoxe 10 years, 3 months ago

This is a change I've noticed in versions

2.27.0 WIP

2.29.1 WIP

The difference I am having in these two is that in

2.27.0 WIP

I can register a 16bit char string class and it works perfectly.

in

2.29.1 WIP

registering the same string factory, I am getting odd results of the strings. Lots of asian characters.

Log(CString &)

Log("Testing Script");

gives

2.27.0 WIP = Testing Script

2.29.1 WIP= Testing Script???

Log("Testing Scrip");

gives

2.27.0 WIP = Testing Scrip

2.29.1 WIP= Testing Scrip

anyone got tips on how to solve this? Kinda hard doing 8bit chars replacement when all of my application uses 16bit strings.

hmm, actually found that it works fine up till 13 letters. 8bit chars works as far as I can put them.

Edit: Somehow adding " / " or " \n " or " n " after the first letter or any letters as long as its not the first sign in I am able to put any number of letters after.

I should probably add that this is just a version of std::string with wchar based on the stdstring addon

Edit2: seems adding those extra / \n or n causes the next strings created to mess up. :S

Advertisement

I'm not sure how to address your issue. I have the most current version of AngelScript (revision 1988), and I don't experience any trouble with my 16-bit string literals.

I specify the 16-bit encoding:


engine->SetEngineProperty(asEP_STRING_ENCODING, 1);

I use MFC's CString class as my string class, and I register the string factory as follows:


CString StringFactory(asUINT length, const wchar_t* s)
{
    return CString(s, (int)(length/2));
}

r = engine->RegisterStringFactory("String", asFUNCTIONPR(StringFactory, (asUINT, const wchar_t*), CString), asCALL_CDECL);

yeah, forgot about the length/2 smile.png sadly I didn't have that in my constructor so I figured I would just do

static CString StringFactory(asUINT length, C8 *s){ CString temp;PFor(length)temp += ConvC8ToC16(s);return temp; }
having angelscript itself be in 16bit char isn't as important to me, I just didn't want to have wrapping functions for everything.
Thanks alot for reminding me of div length by two, this way I can keep angelscript in 8bit and do the conversion on creation.

This topic is closed to new replies.

Advertisement