Skip to content

Commit

Permalink
change what is emitted to the socket to utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed Apr 25, 2011
1 parent 409c743 commit 6e3e321
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chrome/content/server.js
Expand Up @@ -104,6 +104,9 @@ function start(port) {
function onSocketAccepted(serv, transport) {
try {
var outstream = transport.openOutputStream(Ci.nsITransport.OPEN_BLOCKING , 0, 0);
var outstreamutf8 = Cc['@mozilla.org/intl/converter-output-stream;1']
.createInstance(Ci.nsIConverterOutputStream);
outstreamutf8.init(outstream, 'UTF-8', 0, 0);

var stream = transport.openInputStream(0, 0, 0);
var instream = Cc['@mozilla.org/intl/converter-input-stream;1']
Expand All @@ -120,7 +123,7 @@ function onSocketAccepted(serv, transport) {

var session = new REPL();
session.onOutput = function(string) {
outstream.write(string, string.length);
outstreamutf8.writeString(string);
};
session.onQuit = function() {
instream.close();
Expand Down

1 comment on commit 6e3e321

@Corion
Copy link

@Corion Corion commented on 6e3e321 May 29, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please issue a pull request for this feature so it goes into the master branch for Firefox 4?

Having a strict output of UTF-8 would make it much saner for all of us!

Please sign in to comment.