Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Re: encoding problems in the dbgp protocol (in/output streams)

i already tried to only change the rhino debugger like this:

out = new PrintStream(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),"UTF8")));

But that doesnt work if i send over a utf string:

"IOException: no termination '0' byte" this is thrown in DbgpRawPacket


        if (input.read() != 0) {
            throw new IOException(Messages.DbgpRawPacket_noTerminationByte);
        }


Because if we write it as utf8 then we also have to read it as utf8
you cant do it only at one side.

johan





On Wed, Mar 11, 2009 at 14:26, Alex Panchenko <alex@xxxxxxxxx> wrote:
Hi Johan,

This problem occurs with the breakpoint commands, doesn't it?

DBGP protocol is defined in bytes. So, ideally _javascript_ debugger engine could go without PrintStream at all.
Also there are other (external) engine implementations and we should keep compatibility at the protocol level with protocol specification and current implementations.

I think that protocol compatible way to solve original problem is to use specific encoding (UTF-8) for some of the command arguments for the particular debugger engine only.

Regards,
Alex


----- Original Message -----
From: "Johan Compagner" <jcompagner@xxxxxxxxx>
To: "DLTK Developer list" <dltk-dev@xxxxxxxxxxx>
Sent: Wednesday, March 11, 2009 7:02:38 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] Re: encoding problems in the dbgp protocol (in/output streams)

also i see for example this:

out.print(encodeString.length());
out.write(0);
out.print(encodeString);
out.write(0);
out.flush();

what does that length() mean? lenght in bytes?
Because then length() is not correct


On Wed, Mar 11, 2009 at 13:59, Johan Compagner < jcompagner@xxxxxxxxx > wrote:


Hi,

a customer of us does have problems with UTF8 chars when using the debugger
for example he has a utf8 char in the function name.

Then the problem is that i get an exception that there is illegal utf in the stream

we now do this:

eclipse side:
receiver = new DbgpPacketReceiver(new BufferedInputStream(socket
.getInputStream()));


db engine side:
out = new PrintStream(socket.getOutputStream());


So that completely relies on system encoding.
If you would debug on system X and you have eclipse running on system Y this could be a problem.

Wouldnt it be better to use UTF-8 all the way?

something like this:

eclipse side:
receiver = new DbgpPacketReceiver(new BufferedReader(new InputStreamReader(socket.getInputStream(),"UTF8")));


db engine side:
out = new PrintStream(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),"UTF8")));



problem is that we then have a reader instead of input stream, and quite a lot of code that works with inputstreams and bytes should then be changed
to use reader/chars




_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top