Re: [twsocket] Another unicode issue

2011-01-28 Thread Busai Péter

Sorry, they must be surrounded by defines to work in older compilers:

HandleTableRow(TagParams, P + J + 1, Q - P - J - 1,
   RowDataGetter, UserData, DestStream
   {$IFDEF COMPILER12_UP}
   , DestCodePage
   {$ENDIF}
   );

StreamWriteStrA(DestStream, TagValue
   {$IFDEF COMPILER12_UP}
   ,DestCodePage
   {$ENDIF}
   );


Peter

2011.01.27. 21:35 keltezéssel, Busai Péter írta:

Hi Arno,

There were two DestCodePage parameter passover missing in
OverbyteIcsHttpSrv.

function HtmlPageProducerFromMemory
Line: 5068
 HandleTableRow(TagParams, P + J + 1, Q - P - J - 1,
RowDataGetter, UserData, DestStream,
DestCodePage);

and

Line: 5076
 StreamWriteStrA(DestStream, TagValue, DestCodePage);



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-28 Thread Arno Garrels
Busai Péter wrote:
 Sorry, they must be surrounded by defines to work in older compilers:

Thanks for your help.
I just checked in the change. If you use SVN you should revert previous
changes before update in order to avoid conflicts, I changed a little bit more.
It should be available in next daily snapshot ZIP at:
http://wiki.overbyte.be/wiki/index.php/ICS_Download

Or get both files via HTTP:
http://svn.overbyte.be:8443/svn/ics/trunk/Delphi/Vc32/OverbyteIcsHttpSrv.pas
http://svn.overbyte.be:8443/svn/ics/trunk/Delphi/Vc32/OverbyteIcsHttpAppServer.pas

-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-28 Thread Busai Péter



I just checked in the change. If you use SVN you should revert previous
changes before update in order to avoid conflicts,

Resolve conflicts using 'theirs' is just one click ;)

Peter
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-28 Thread Arno Garrels
Busai Péter wrote:
 I just checked in the change. If you use SVN you should revert
 previous changes before update in order to avoid conflicts,
 Resolve conflicts using 'theirs' is just one click ;)

True, forgot about it :) That's however fatal if you have uncommitted
private changes.

-- 
Arno Garrels





--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-27 Thread Arno Garrels
Busai Péter wrote:
 In HttpAppServer, URLHandler
 
 Call
 Client.AnswerPage(Flags,'','','template.html',nil,['SOMEKEY','A']); 
 
 The value of SOMEKEY must be one character long.
 
 Result rendered in html page:
 Unsupported TVarRec.VType = vtWideChar

I uploaded changed versions of OverbyteIcsHttpSrv.pas and 
OverbyteIcsHttpAppServer.pas here:
http://www.duodata.de/misc/delphi/ics/OverbyteIcsHttpSrv733.zip 

Fixed VarRecToString. AnswerPage and other functions take 
optional codepage parameters now, you asked that some days back.
So it should now be possible to write i.e. UTF-8 encoded HTML
by passing CP_UTF8 in parameter DstCodePage, the default is
CP_ACP. Since it's not much tested please give it a trial and 
let me know how it works for you before I upload this change to
the repository.

-- 
Arno Garrels  
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-27 Thread Arno Garrels
Arno Garrels wrote:
 Busai Péter wrote:
 In HttpAppServer, URLHandler
 
 Call
 Client.AnswerPage(Flags,'','','template.html',nil,['SOMEKEY','A']);
 
 The value of SOMEKEY must be one character long.
 
 Result rendered in html page:
 Unsupported TVarRec.VType = vtWideChar
 
 I uploaded changed versions of OverbyteIcsHttpSrv.pas and
 OverbyteIcsHttpAppServer.pas here:
 http://www.duodata.de/misc/delphi/ics/OverbyteIcsHttpSrv733.zip
 
 Fixed VarRecToString. AnswerPage and other functions take
 optional codepage parameters now, you asked that some days back.
 So it should now be possible to write i.e. UTF-8 encoded HTML
 by passing CP_UTF8 in parameter DstCodePage, the default is
 CP_ACP. Since it's not much tested please give it a trial and
 let me know how it works for you before I upload this change to
 the repository.

Just in case you downloaded the wrong ZIP, VarRecToString should
look like:

function VarRecToString(V : TVarRec) : String;
const
BooleanToString : array [Boolean] of String = ('FALSE', 'TRUE');
begin
case V.VType of
vtInteger:Result := _IntToStr(V.VInteger);
vtBoolean:Result := BooleanToString[V.VBoolean];
vtChar:   Result := String(V.VChar);
vtExtended:   Result := _FloatToStr(V.VExtended^);
vtString: Result := String(V.VString^);
vtPointer:Result := 'Unsupported TVarRec.VType = vtPointer';
vtPChar:  Result := String(_StrPas(V.VPChar));
vtObject: Result := 'Unsupported TVarRec.VType = vtObject';
vtClass:  Result := 'Unsupported TVarRec.VType = vtClass';
vtWideChar:   Result := String(V.VWideChar);
vtPWideChar:  Result := String(V.VPWideChar);
vtAnsiString: Result := String(_StrPas(V.VPChar));
vtCurrency:   Result := 'Unsupported TVarRec.VType = vtCurrency';
vtVariant:Result := 'Unsupported TVarRec.VType = vtVariant';
vtWideString: Result := 'Unsupported TVarRec.VType = vtWideString';
vtInterface:  Result := 'Unsupported TVarRec.VType = vtInterface';
vtInt64:  Result := _IntToStr(V.VInt64^);
{$IFDEF COMPILER12_UP}
vtUnicodeString:  Result := PWideChar(V.VUnicodeString);
{$ENDIF}
else
Result := 'Unknown TVarRec.VType = ' + _IntToStr(Ord(V.VType)) + ' ';
end;

//OutputDebugString(PChar('VarRecToString ' + Result));
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another unicode issue

2011-01-27 Thread Busai Péter
Hi Arno,

There were two DestCodePage parameter passover missing in
OverbyteIcsHttpSrv.

function HtmlPageProducerFromMemory
Line: 5068
HandleTableRow(TagParams, P + J + 1, Q - P - J - 1,
   RowDataGetter, UserData, DestStream,
DestCodePage);

and

Line: 5076
StreamWriteStrA(DestStream, TagValue, DestCodePage);

Now it seems to work as expected.
I just tried UTF8
I have template file in UTF8 format and I need UTF8 encoded results.
With these two corrections Tag values are also converted.

It seems vtWideChar problem solved also.
I tested on Delphi XE, but had no time to test it on ansi compiler.

Thank you very much

Peter

2011.01.27. 18:22 keltezéssel, Arno Garrels írta:
 Arno Garrels wrote:
 Busai Péter wrote:
 In HttpAppServer, URLHandler

 Call
 Client.AnswerPage(Flags,'','','template.html',nil,['SOMEKEY','A']);

 The value of SOMEKEY must be one character long.

 Result rendered in html page:
 Unsupported TVarRec.VType = vtWideChar
 I uploaded changed versions of OverbyteIcsHttpSrv.pas and
 OverbyteIcsHttpAppServer.pas here:
 http://www.duodata.de/misc/delphi/ics/OverbyteIcsHttpSrv733.zip

 Fixed VarRecToString. AnswerPage and other functions take
 optional codepage parameters now, you asked that some days back.
 So it should now be possible to write i.e. UTF-8 encoded HTML
 by passing CP_UTF8 in parameter DstCodePage, the default is
 CP_ACP. Since it's not much tested please give it a trial and
 let me know how it works for you before I upload this change to
 the repository.
 Just in case you downloaded the wrong ZIP, VarRecToString should
 look like:

 function VarRecToString(V : TVarRec) : String;
 const
 BooleanToString : array [Boolean] of String = ('FALSE', 'TRUE');
 begin
 case V.VType of
 vtInteger:Result := _IntToStr(V.VInteger);
 vtBoolean:Result := BooleanToString[V.VBoolean];
 vtChar:   Result := String(V.VChar);
 vtExtended:   Result := _FloatToStr(V.VExtended^);
 vtString: Result := String(V.VString^);
 vtPointer:Result := 'Unsupported TVarRec.VType = vtPointer';
 vtPChar:  Result := String(_StrPas(V.VPChar));
 vtObject: Result := 'Unsupported TVarRec.VType = vtObject';
 vtClass:  Result := 'Unsupported TVarRec.VType = vtClass';
 vtWideChar:   Result := String(V.VWideChar);
 vtPWideChar:  Result := String(V.VPWideChar);
 vtAnsiString: Result := String(_StrPas(V.VPChar));
 vtCurrency:   Result := 'Unsupported TVarRec.VType = vtCurrency';
 vtVariant:Result := 'Unsupported TVarRec.VType = vtVariant';
 vtWideString: Result := 'Unsupported TVarRec.VType = vtWideString';
 vtInterface:  Result := 'Unsupported TVarRec.VType = vtInterface';
 vtInt64:  Result := _IntToStr(V.VInt64^);
 {$IFDEF COMPILER12_UP}
 vtUnicodeString:  Result := PWideChar(V.VUnicodeString);
 {$ENDIF}
 else
 Result := 'Unknown TVarRec.VType = ' + _IntToStr(Ord(V.VType)) + ' 
 ';
 end;

 //OutputDebugString(PChar('VarRecToString ' + Result));
 end;

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be