Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/intl/uconv/tests/unit/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Impressum test_bug381412.gb2312.js   Sprache: JAVA

 

const charset = "GB2312";

function error(inString, outString, msg) {
  var dispIn = "";
  var dispOut = "";
  var i;
  for (i = 0; i < inString.length; ++i) {
    dispIn += " x" + inString.charCodeAt(i).toString(16);
  }
  if (!outString.length) {
    dispOut = "<empty>";
  } else {
    for (i = 0; i < outString.length; ++i) {
      dispOut += " x" + outString.charCodeAt(i).toString(16);
    }
  }
  dump('"' + dispIn + '" ==> "' + dispOut + '"\n');
  do_throw("security risk: " + msg);
}

function run_test() {
  var ScriptableUnicodeConverter = Components.Constructor(
    "@mozilla.org/intl/scriptableunicodeconverter",
    "nsIScriptableUnicodeConverter"
  );

  var converter = new ScriptableUnicodeConverter();
  converter.charset = charset;

  var leadByte, trailByte;
  var inString;
  for (leadByte = 1; leadByte < 0x100; ++leadByte) {
    for (trailByte = 1; trailByte < 0x100; ++trailByte) {
      inString = String.fromCharCode(leadByte, trailByte, 65);
      var outString = converter.ConvertToUnicode(inString) + converter.Finish();
      switch (outString.length) {
        case 1:
          error(inString, outString, "2 byte sequence eaten");
          break;
        case 2:
          if (
            outString.charCodeAt(0) < 0x80 &&
            outString.charCodeAt(1) < 0x80
          ) {
            error(inString, outString, "2 byte sequence converted to 1 ASCII");
          }
          break;
        case 3:
          if (
            outString != inString &&
            outString.charCodeAt(0) < 0x80 &&
            outString.charCodeAt(1) < 0x80
          ) {
            error(inString, outString, "2 byte sequence converted to 2 ASCII");
          }
          break;
      }
    }
  }
}

Messung V0.5 in Prozent
C=100 H=49 G=78

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:  (vorverarbeitet am  2026-09-28) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.