Bug Issue: convertToPseudoUnicode() not working in HTML5


Pages: 1

FMStudioGameDev

  • Subscriber - Stencyl Studio
  • *
January 17, 2017, 08:56:59 am
Well title explains  almost everything.
There is no way to show special characters when targetting HTML5, function
Code: [Select]
convertToPseudoUnicode() allows to display everything correctly on all platforms except HTML5.
This is quite a crucial issue for some languages (russian and korean for example, but also impossible to show some characters in spanish, french, german...)
Thank you


Issue updated by rob1221 - January 17, 2017, 09:15:11 am
  • Category changed from Font Editor to Engine


Justin

  • Master Stencyler
  • *
September 04, 2017, 06:45:07 pm
I don't see an obvious difference between html5 and other non-flash targets. Could you share an example and the expected/actual output?
  • Issue Assigned from (none) to Justin
  • Status changed from New to Need Info


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 10, 2017, 02:13:17 pm
Indeed, the character just doesn't show when you want to draw it.
   it should be créer, but the é has disappeared.

if you trace it
in flash:
créer
in html:
cr~x9000er

https://github.com/Stencyl/stencyl-engine/blob/ba1065422321de30e8e9bc955177395d21742ad7/com/stencyl/behavior/Script.hx#L3765

if you trace the formatted string

in windows: 00E9
in html:9000
« Last Edit: October 10, 2017, 03:23:32 pm by yoplalala »


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 10, 2017, 04:15:18 pm
// add UTF-8 to utf8List
               trace("push " + internationalText.charCodeAt(utf8count));
                  utf8List.push(internationalText.charCodeAt(utf8count));
                  realCount += 1;

In windows :
push 195
push 169

In Html
push 233

some problems with charCodeAt ?


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 11, 2017, 01:06:36 am
The problem is that js is UTF16  so you nee to convert from UTF16 to UTF32 and not from UTF8 to UTF32


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 11, 2017, 02:40:42 am
Okay if it html5/js
it seems you can skip many conversions.

Should work for two bytes characters, but not for 4 bytes characters
var formattedHexString:String = "00" + StringTools.hex(character);


Stopping here :)


Issue updated by Justin - February 01, 2018, 10:59:11 am
  • Tags added: 3.5 NP


Issue updated by Justin - July 10, 2018, 09:18:09 pm
  • Tags added: html5


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 27, 2018, 11:27:51 am
Here is commit to repair unicode ( and correct also unicode on html)
No need to use convertToPSeudoUnicode anymore

https://github.com/Stencyl/stencyl-engine/pull/48/commits/e629b1557c1ceafad7567041a6ceb10f5c0bc0bc


rob1221

  • Master Stencyler
  • *
October 27, 2018, 12:31:28 pm
Testing with the word "créer" from a text file still gives me "crer" in HTML5 while it's fine on Flash.  Windows just crashes.


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 27, 2018, 01:29:47 pm
Hmm thanks. For me it works perfectly on Flash and HTML5 but I think I understood. On Linux the text doesn't appear entirely,
I just need to change  font get width too.  I'll try to test it on Windows as it seems to behave totally differently.


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 28, 2018, 03:31:22 am
proposed a new pull which works perfectly for me. Tested on flash , linux, windows, html5.
Saying this,  I tested my old commmit on t windows and I hadn't these problems.

Oh I tested only on 3.5.   Not sure if  unifill was integrated in 3.4


rob1221

  • Master Stencyler
  • *
October 28, 2018, 06:43:08 am
I'm using the latest 3.5 build and don't see any improvement.  The error popup I get on Windows says "InvalidCodeUnitSequence(index: 2)"  This is on Windows 10 64-bit.


yoplalala

  • Subscriber - Stencyl Studio
  • *
October 28, 2018, 09:15:07 am
Ok I understood. That's because your file is in ANSI not UTF-8.  Saying this , I'll to correct this so that when there's ANSI, it doesn't crash everything.
( or I do it the simple way and just correct pseuduUnicode function, but this would be a shame... )


rob1221

  • Master Stencyler
  • *
October 28, 2018, 09:32:37 am
Yeah I can confirm that everything looks fine after changing the file format.


yoplalala

  • Subscriber - Stencyl Studio
  • *
November 01, 2018, 06:45:51 am
I don't know how to in a intelligent way  and clear way to correct BitmapDataFont.

So for now, just correcting convertToPseudoUnicode()
https://github.com/Stencyl/stencyl-engine/pull/50


rob1221

  • Master Stencyler
  • *
November 01, 2018, 07:11:59 am
convertToPseudoUnicode is working fine for text typed in Stencyl blocks as well as from a UTF-8 file.  It doesn't work with ANSI files, but it also doesn't crash any more.  Did it used to work for ANSI files in the past or did that always not work?


yoplalala

  • Subscriber - Stencyl Studio
  • *
November 01, 2018, 07:20:25 am
No I don't think it ever worked. But maybe ansi worked without using the  convertToPseudoUnicode but I don't think either as i wouldn't have had the need to use convertToPseudoUnicode :P


rob1221

  • Master Stencyler
  • *
November 01, 2018, 09:08:31 am
Alright, I merged the PR.  Thanks for your work on this.
  • Status changed from Need Info to Resolved


Issue updated by Justin - November 02, 2018, 04:28:51 am


Pages: 1

Details

  • Reported
    January 17, 2017, 08:56:59 am
  • Updated
    November 02, 2018, 04:28:51 am

  • View Status
    Public
  • Type
    Bug
  • Status
    Resolved
  • Priority
    Normal
  • Version
    Stencyl 3.4
  • Fixed in
    (none)
  • Assigned to
    rob1221
  • Category
    Engine

Tags