nsIConverterOutputStream handling GB2312 characters

'Herong's Tutorial Notes on GB2312 Character Set' book was cited in a MozillaZine forum post in 2012.

The Herong's Tutorial Notes on GB2312 Character Set book was cited in a MozillaZine forum post in 2012.

Subject: nsIConverterOutputStream handling GB2312 characters
Date: March 25, 2012
Author: morat
Source: http://forums.mozillazine.org/viewtopic.php?f=19&t=2447729

I cannot get the GB2312 converter to use the replacement character.
I guess a bug.

var data = "\u0080"; // invalid
var file = Components.
  classes["@mozilla.org/file/directory_service;1"].
  getService(Components.interfaces.nsIProperties).
  get("ProfD", Components.interfaces.nsIFile);
file.append("test.txt");
var stream = Components.
  classes["@mozilla.org/network/file-output-stream;1"].
  createInstance(Components.interfaces.nsIFileOutputStream);
var converter = Components.
  classes["@mozilla.org/intl/converter-output-stream;1"].
  createInstance(Components.interfaces.nsIConverterOutputStream);
try {
  stream.init(file, 0x02|0x08|0x10, parseInt("666", 8), 0);
     converter.init(stream, "ISO-8859-1", 0, 0x0000);
  // converter.init(stream, "ISO-8859-1", 0, 0x0041);
  // converter.init(stream, "GB2312", 0, 0x0000);
  // converter.init(stream, "GB2312", 0, 0x0041);
  converter.writeString(data);
} finally {
  converter.close();
  stream.close();
}

Tutorial Notes on GB2312
https://www.herongyang.com/gb2312/

Table of Contents

 About This Book

 Reference Citations in 2023

 Reference Citations in 2022

 Reference Citations in 2021

 Reference Citations in 2020

 Reference Citations in 2019

 Reference Citations in 2018

 Reference Citations in 2017

 Reference Citations in 2016

 Reference Citations in 2015

 Reference Citations in 2014

 Reference Citations in 2013

Reference Citations in 2012

 bikin website dalam bahasa cina dengan php

 72 sekunde kao 72 godine

nsIConverterOutputStream handling GB2312 characters

 AbstractMethodError while calling PreparedStatement.setBinaryStream()

 how to invoke web service without generating a client

 Sample program to test SSL Connection with certicates

 How to know KeyManager given a keystore

 once again: classpath and ojdbc14.jar

 12c... webtier up, Oracle managment server down

 Problems with class not found exception

 Spring Projects > Roo > Issue with Chinese characters

 Monkey Programming/Unsigned Shift Right

 Unable to get issuer certificate

 How to convert keystore (from native android project) to .p12 to use with AIR project?

 Installing JDBC drivers ojdbc14.jar

 Quickly view the threads of your blocked Ruby application with JStack

 android verify signature of file with .der public key

 Unable to install updates KB2770917 and KB2779768

 Reference Citations in 2011

 Reference Citations in 2010

 Reference Citations in 2009

 Reference Citations in 2008

 Reference Citations in 2007

 Reference Citations in 2006

 Reference Citations in 2005

 Reference Citations in 2004

 Reference Citations in 2003