Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Version changes on 16bit string structures?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Zervoxe   Members   -  Reputation: 513

Like
0Likes
Like

Posted 14 August 2014 - 02:58 AM

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.

Edited by Zervoxe, 14 August 2014 - 04:03 AM.


Sponsor:

#2 Zervoxe   Members   -  Reputation: 513

Like
0Likes
Like

Posted 14 August 2014 - 03:58 AM

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


Edited by Zervoxe, 14 August 2014 - 04:56 AM.


#3 Jason Goepel   Members   -  Reputation: 416

Like
0Likes
Like

Posted 14 August 2014 - 05:16 AM

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);


#4 Zervoxe   Members   -  Reputation: 513

Like
0Likes
Like

Posted 14 August 2014 - 08:12 AM

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[i]);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.

Edited by Zervoxe, 14 August 2014 - 08:47 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS