Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - BubbleChien

Pages: [1]
1
System / [SOLVED] Trouble converting v8::String::Utf8Value to sf::String
« on: January 10, 2015, 11:55:34 am »
Hey!

I've been attempting to convert from v8::String::Utf8Value (which return a char*) to sf::String.

Using a temp std::string with sf::String::fromUtf8 fails.

I'm using the sf::String to feed sf::Text, and while giving the UTF-8 string directly gives the expected extra characters, the result of fromUtf8 shows question marks in squares. The font is fine, tried using a wide string literal and it worked.

Here's what I'm doing at the moment :

JS_RETRIEVE_INSTANCE(sf::Text); // this creates the instance variable
v8::String::Utf8Value str(val); // val is a v8::Local<v8::Value> variable
std::string utf8(*str); // here *str returns a char*
instance->setString(sf::String::fromUtf8<std::string::iterator>(utf8.begin(),utf8.end()));

I'm probably missing some obvious stuff since I haven't really had to deal with encodings in the past, so that would be great if someone's able to help me :)

EDIT: Some changes in the code fixed it, though I have no clue what did; pretty sure the issue was not SFML related.

Pages: [1]