rem: for (i = 0; i < charsetList.Count(); i++) 
add: var atom; var str; var tit; var visible;  for (var i = 0; i < charsetList.Count(); i++) 
context: function LoadAvailableCharSets(){  try {    var ccm	= Components.classes['@mozilla.org/charset-converter-manager;1'];    if (ccm) {      ccm = ccm.getService();      ccm = ccm.QueryInterface(Components.interfaces.nsICharsetConverterManager2);      charsetList = ccm.GetDecoderList();      charsetList = charsetList.QueryInterface(Components.interfaces.nsISupportsArray);      charsetList.sort;    }  } catch(ex)  {    dump("failed to get charset mgr\n");  }  if (charsetList)   {    var j=0;    for (i = 0; i < charsetList.Count(); i++)     {      atom = charsetList.GetElementAt(i);      atom = atom.QueryInterface(Components.interfaces.nsIAtom);        if (atom) {        str = atom.GetUnicode();        try {          tit = ccm.GetCharsetTitle(atom);        } catch (ex) {          tit = str; //don't ignore charset detectors without a title        }              try {                                            visible = ccm.GetCharsetData(atom,'.notForBrowser');          visible = false;        } catch (ex) {          visible = true;          charsetDict[j] = new Array(2);          charsetDict[j][0]  = tit;            charsetDict[j][1]  = str;          j++;          //dump('Getting invisible for:' + str + ' failed!\n');        }      } //atom      } //for    ClearTreelist(dialog.charsetTree);    charsetDict.sort();    var selItem;    if (charsetDict)     {      for (i = 0; i < charsetDict.length; i++)       {        try {  //let's beef up our error handling for charsets without label / title//dump("add " + charsetDict[i][0] + charsetDict[i][1] + "\n");          var item = AppendStringToTreelist(dialog.charsetTree, charsetDict[i][0]);          if(item) {             var row= item.firstChild;             if(row) {                var cell= row.firstChild;                if(cell) {                   cell.setAttribute("value", charsetDict[i][1]);                }             }             if(charset == charsetDict[i][1] )              {               selItem = item;//dump("hit default " + charset + "\n");             }          }        } //try        catch (ex) {          dump("*** Failed to add charset: " + tit + ex + "\n");        } //catch      } //for    } // if    if(selItem) {        try {        dialog.charsetTree.selectItem(selItem);        dialog.charsetTree.ensureElementIsVisible(selItem);        } catch (ex) {          dump("*** Failed to select and ensure : " + ex + "\n");        }    }  } // if}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/350ed16243aaf3b59f053ce3c75d906d992afd7c/EditorSaveAsCharset.js/clean/editor/ui/dialogs/content/EditorSaveAsCharset.js