roscminni Posted April 22, 2014 Share Posted April 22, 2014 Does anybody know what the best way to get accents or special characters to work with the text object? I have set the meta tag in my index.html to UTF-8, but I still have no luck, Thanks. Link to comment Share on other sites More sharing options...
Pedro Alpera Posted April 22, 2014 Share Posted April 22, 2014 Could you try this? :window.onload = function () { var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update}); function preload() { } function create() { var text = "- phaser -\n áéíóú ÁÉÍÓÚ ñÑ"; var style = { font: "65px Arial", fill: "#ff0044", align: "center" }; var t = game.add.text(game.world.centerX-300, 0, text, style); } function update() { }}; Link to comment Share on other sites More sharing options...
roscminni Posted April 23, 2014 Author Share Posted April 23, 2014 Thanks for your reply. I tried that code using a separate html file, and the characters were still coming out as <?> blocks. Link to comment Share on other sites More sharing options...
PhaserFan Posted April 23, 2014 Share Posted April 23, 2014 I have used Phaser with Spanish text and it works perfectly well. I think it has nothing to do with Phaser but with the HTML files. As you said, you should use in the header: <meta charset="utf-8" /> But that is not enough, take into account that your text editor should be able to save your HTML file in UTF-8. Probably, the 'meta' says your 'charset' is UTF-8 but the file it is not. Link to comment Share on other sites More sharing options...
roscminni Posted April 27, 2014 Author Share Posted April 27, 2014 Thanks PhaserFan, that was the answer. I'm using eclipse with the aptana plugin, which seems to default to CP1252 charset - which is odd because I aptana is for web development and UTF-8 is the most common charset used. Strange. Link to comment Share on other sites More sharing options...
x2l2 Posted July 31, 2014 Share Posted July 31, 2014 in some servers i have to create a .htaccess file with :AddDefaultCharset utf-8 roscminni 1 Link to comment Share on other sites More sharing options...
Recommended Posts