Filepath looks fine in UTF8 BOM, but doesn't render. UTF8 changes the string :S


Hey Embers,

A while back I asked a bit about UTF8 things in Cinder and got some great help. Now I’m back again.

So the following string is what I’d like to render: Röyksopp feat. Robyn - Monument (The Inevitable End Version).mp3

Obviously the ‘ö’ letter is what’s causing me problems. If the file is saved as UTF-8-BOM, then in the debugger the string looks fine, but Cinder eventually throws a ‘internal::INVALID_CODE_POINT’ error at line 150 in checked.h as part of the render code belonging to ci::TextBox.

If I instead change the encoding to UTF-8, the rendering code passes fine, but the string is altered to the following ‘Röyksopp feat. Robyn - Monument (The Inevitable End Version).mp3’ and is then unusable to use for loading purposes. :confused:

Anyone have any sage advice as to what might make both things work well?



Using utf8cpp before using a string works for me when handling spanish and portuguese text in an TextBox:

#include "utf8cpp/checked.h"

std::string temp;
//UTF8 valid checkout
utf8::replace_invalid(text.begin(), text.end(), back_inserter(temp));
mText = temp;

ci::TextBox tbox = ci::TextBox()
tbox.setBackgroundColor( ci::ColorA( 0.0, 0.0, 0.0, 0.0 ) );
ci::ivec2 sz = tbox.measure();
ci::gl::TextureRef texture = ci::gl::Texture2d::create(tbox.render());
setTexture( texture );