Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 18 total
Thread Special characters
Wed, Mar 4 2015 10:59 AMPermanent Link

Ronald

Hi,

I am using DelphiXE5 and I manage the database acces to MS SQL with an an
(DelphiXE5) server .exe. If I save a form with a é in a field all goes fine
if I use Explorer of Safari, but if I use Firefox or Chrome, my .exe freezes
and the record is not saved. I even have to end the process on the server.
What could be the problem?

Greetings,
Ronald

Wed, Mar 4 2015 1:43 PMPermanent Link

Ronald

I forget to mention that I sent the fields as a var=value list to the
server. Should I explictly set the charset in the header?

"Ronald"  schreef in bericht
news:2CA7002D-F984-48A4-B9C4-BE21377A8C47@news.elevatesoft.com...

Hi,

I am using DelphiXE5 and I manage the database acces to MS SQL with an an
(DelphiXE5) server .exe. If I save a form with a é in a field all goes fine
if I use Explorer of Safari, but if I use Firefox or Chrome, my .exe freezes
and the record is not saved. I even have to end the process on the server.
What could be the problem?

Greetings,
Ronald
Wed, Mar 4 2015 2:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ronald,

<< I am using DelphiXE5 and I manage the database acces to MS SQL with an an
(DelphiXE5) server .exe. If I save a form with a é in a field all goes fine
if I use Explorer of Safari, but if I use Firefox or Chrome, my .exe freezes
and the record is not saved. I even have to end the process on the server.
>>

When you say that you have to "end the process on the server", which process
are you referring to - the browser or the EWB IDE/EWB Web Server ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Mar 4 2015 5:01 PMPermanent Link

Ronald

I mean the .exe on the server (webbroker). I do not set the contentlength.
Could it be that Chrome and Firefox have a problem with that?

"Tim Young [Elevate Software]"  schreef in bericht
news:C50C8681-D4BB-43E8-A2A4-8AB3689986FC@news.elevatesoft.com...

Ronald,

<< I am using DelphiXE5 and I manage the database acces to MS SQL with an an
(DelphiXE5) server .exe. If I save a form with a é in a field all goes fine
if I use Explorer of Safari, but if I use Firefox or Chrome, my .exe freezes
and the record is not saved. I even have to end the process on the server.
>>

When you say that you have to "end the process on the server", which process
are you referring to - the browser or the EWB IDE/EWB Web Server ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Mar 5 2015 4:09 AMPermanent Link

Ronald

Adding the size does not help:

srSave.RequestHeaders.Clear;
srSave.RequestHeaders.Add('Content-Type: text/plain;charset=utf-8');

srSave.RequestContent.Clear;
srSave.RequestContent.Text:=GetRecordAsVarValue(tbMM);

srSave.RequestHeaders.Add('Content-Length:'+IntToStr(Length(srSave.RequestContent.Text)));

My .exe freezes if I refer to Request.ContentFields.Count, but this is only
a problem for Firefox and Chrome.


"Ronald"  schreef in bericht
news:77ABDEC7-0B83-4EE7-99AC-0DA00231B527@news.elevatesoft.com...

I mean the .exe on the server (webbroker). I do not set the contentlength.
Could it be that Chrome and Firefox have a problem with that?

"Tim Young [Elevate Software]"  schreef in bericht
news:C50C8681-D4BB-43E8-A2A4-8AB3689986FC@news.elevatesoft.com...

Ronald,

<< I am using DelphiXE5 and I manage the database acces to MS SQL with an an
(DelphiXE5) server .exe. If I save a form with a é in a field all goes fine
if I use Explorer of Safari, but if I use Firefox or Chrome, my .exe freezes
and the record is not saved. I even have to end the process on the server.
>>

When you say that you have to "end the process on the server", which process
are you referring to - the browser or the EWB IDE/EWB Web Server ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Mar 5 2015 4:58 AMPermanent Link

Matthew Jones

Ronald wrote:

> I am using DelphiXE5 and I manage the database acces to MS SQL with
> an an (DelphiXE5) server .exe. If I save a form with a é in a field
> all goes fine if I use Explorer of Safari, but if I use Firefox or
> Chrome, my .exe freezes and the record is not saved. I even have to
> end the process on the server.  What could be the problem?

Hmm, not idea about the freezing, but I had to work a little to make
sure that the strings that come across from EWB browser fields as UTF8
were stored and "round tripped" accurately.

I can't remember the full details, but here's a bit of code that did
some mangling to make sure it worked. I think the Utf8ToString is a key
- it is in XE2, not sure about other versions.This code reads from the
database, and puts it into a JSON UTF8String for sending to the browser.


szUTF8Value := UTF8String(xWorkQuery.FieldByName(szName).AsAnsiString);
if szUTF8Value <> '' then
begin
 szUniValue := Utf8ToString(szUTF8Value);
 json_WriteString(xJSON, szJSONName, szUniValue);
end;

--

Matthew Jones
Thu, Mar 5 2015 5:10 AMPermanent Link

Ronald

Thanks Matthew, but my problem is from the browser to the server (CGI stand
alone .exe). As soon as I refer to Request.ContentFields in the action, the
server .exe freezes (or is in an eternal loop?).

"Matthew Jones"  schreef in bericht
news:F36F2840-0275-4D8E-8F25-9DDA63ACA962@news.elevatesoft.com...

Ronald wrote:

> I am using DelphiXE5 and I manage the database acces to MS SQL with
> an an (DelphiXE5) server .exe. If I save a form with a é in a field
> all goes fine if I use Explorer of Safari, but if I use Firefox or
> Chrome, my .exe freezes and the record is not saved. I even have to
> end the process on the server.  What could be the problem?

Hmm, not idea about the freezing, but I had to work a little to make
sure that the strings that come across from EWB browser fields as UTF8
were stored and "round tripped" accurately.

I can't remember the full details, but here's a bit of code that did
some mangling to make sure it worked. I think the Utf8ToString is a key
- it is in XE2, not sure about other versions.This code reads from the
database, and puts it into a JSON UTF8String for sending to the browser.


szUTF8Value := UTF8String(xWorkQuery.FieldByName(szName).AsAnsiString);
if szUTF8Value <> '' then
begin
 szUniValue := Utf8ToString(szUTF8Value);
 json_WriteString(xJSON, szJSONName, szUniValue);
end;

--

Matthew Jones
Thu, Mar 5 2015 6:01 AMPermanent Link

Ronald

If I add the header: Content-Type: text/plain;charset="utf-8" then my server
..exe now freezes also in Explorer. Maybe a dumb remark, but it seems like I
do not really send UTF-8?


"Ronald"  schreef in bericht
news:4457B53E-2C53-43AE-A8E5-6A460D182634@news.elevatesoft.com...

Thanks Matthew, but my problem is from the browser to the server (CGI stand
alone .exe). As soon as I refer to Request.ContentFields in the action, the
server .exe freezes (or is in an eternal loop?).

"Matthew Jones"  schreef in bericht
news:F36F2840-0275-4D8E-8F25-9DDA63ACA962@news.elevatesoft.com...

Ronald wrote:

> I am using DelphiXE5 and I manage the database acces to MS SQL with
> an an (DelphiXE5) server .exe. If I save a form with a é in a field
> all goes fine if I use Explorer of Safari, but if I use Firefox or
> Chrome, my .exe freezes and the record is not saved. I even have to
> end the process on the server.  What could be the problem?

Hmm, not idea about the freezing, but I had to work a little to make
sure that the strings that come across from EWB browser fields as UTF8
were stored and "round tripped" accurately.

I can't remember the full details, but here's a bit of code that did
some mangling to make sure it worked. I think the Utf8ToString is a key
- it is in XE2, not sure about other versions.This code reads from the
database, and puts it into a JSON UTF8String for sending to the browser.


szUTF8Value := UTF8String(xWorkQuery.FieldByName(szName).AsAnsiString);
if szUTF8Value <> '' then
begin
 szUniValue := Utf8ToString(szUTF8Value);
 json_WriteString(xJSON, szJSONName, szUniValue);
end;

--

Matthew Jones
Thu, Mar 5 2015 6:19 AMPermanent Link

Matthew Jones

Ronald wrote:

> If I add the header: Content-Type: text/plain;charset="utf-8" then my
> server .exe now freezes also in Explorer. Maybe a dumb remark, but it
> seems like I do not really send UTF-8?

UTF8 requires certain things from a characters over the 127 value. The
accented character will have that high bit set, and it is possible that
something is parsing it and not interpreting it properly. Hmm, is this
the last character in the string? I wonder if there is a nul byte
(zero) following, and then the parser wonders off into memory.

Anyway, I think you have two steps here to help debug. First, I don't
really understand where this is failing - sending to or from the
server, but use the F12 debugging capabilities of Chrome to see what is
happening. You can set breakpoints and everything. Once javascript is
stuck in a loop, you lose the browser, but if you can break point it
you can often see where it is failing.

If it is the server, then you need to work out how to get the debugger
on that. I suspect it would be hard, but once you have it you can hit
pause and see where it is stuck.

Good luck!

--

Matthew Jones
Thu, Mar 5 2015 10:43 AMPermanent Link

Ronald

UTF8 is a real problem. Meantime I found the following. I I use the
SubmitForm method of the form it works correct and no the .exe does not
freeze. Apparently the SubmitForm method does something important that I
miss.

"Matthew Jones"  schreef in bericht
news:49BD3009-714A-4D0F-8666-4613C1CD0F79@news.elevatesoft.com...

Ronald wrote:

> If I add the header: Content-Type: text/plain;charset="utf-8" then my
> server .exe now freezes also in Explorer. Maybe a dumb remark, but it
> seems like I do not really send UTF-8?

UTF8 requires certain things from a characters over the 127 value. The
accented character will have that high bit set, and it is possible that
something is parsing it and not interpreting it properly. Hmm, is this
the last character in the string? I wonder if there is a nul byte
(zero) following, and then the parser wonders off into memory.

Anyway, I think you have two steps here to help debug. First, I don't
really understand where this is failing - sending to or from the
server, but use the F12 debugging capabilities of Chrome to see what is
happening. You can set breakpoints and everything. Once javascript is
stuck in a loop, you lose the browser, but if you can break point it
you can often see where it is failing.

If it is the server, then you need to work out how to get the debugger
on that. I suspect it would be hard, but once you have it you can hit
pause and see where it is stuck.

Good luck!

--

Matthew Jones
Page 1 of 2Next Page »
Jump to Page:  1 2
Image