Page 1 of 1

Bug in ASCIIEncoding.GetBytes [SOLVED]

Posted: Thu Sep 10, 2015 11:46 am
by CyborgDE
Hello,

ASCIIEncoding.GetBytes works under Windows.

In Java I got a NullReferenceException at "this.fallbackCharacter" :

Code: Select all

JSIL.ImplementExternals("System.Text.ASCIIEncoding", function ($) {
  $.RawMethod(false, "$encode", function ASCIIEncoding_Encode (string, outputBytes, outputIndex) {
    var writer = this.$makeWriter(outputBytes, outputIndex);
   
    var fallbackCharacter = this.fallbackCharacter.charCodeAt(0);
    var reader = this.$makeCharacterReader(string), ch;


this solves the issue (for the moment) :

Code: Select all

JSIL.ImplementExternals("System.Text.ASCIIEncoding", function ($) {
  $.RawMethod(false, "$encode", function ASCIIEncoding_Encode (string, outputBytes, outputIndex) {
    var writer = this.$makeWriter(outputBytes, outputIndex);
   
    if ( this.fallbackCharacter == null) {
        this.fallbackCharacter = "?";
    }

    var fallbackCharacter = this.fallbackCharacter.charCodeAt(0);
    var reader = this.$makeCharacterReader(string), ch;


Regards
Uwe

Re: Bug in ASCIIEncoding.GetBytes

Posted: Wed Sep 16, 2015 7:53 am
by JS-Support @Userware
Hello,

Thanks a lot for the contribution!

We have just added it to the upcoming Beta 5.

Regards,
JS-Support