Page 1 of 1

Character issue on Custom and Default NoticeProcessor

Posted: 01.04.2013, 21:02
by Densetsu7
I was trying to receive the following message on my application:
"pDisparaFuncao(6,serviço)"
It happens that either using a custom NoticeProcessor (using SetNoticeProcessor method) or using the DefaultNoticeProcessor, my application receives the following message:
"pDisparaFuncao(6,serviço)"

Just created a varchar funcion at PostgreSQL as follows:

Code: Select all

CREATE OR REPLACE FUNCTION sigh.f_notice_sem_acento()
  RETURNS varchar AS
$BODY$

declare

begin

	raise notice 'pDisparaFuncao(6,%)', 'serviço';

	return '';

end

$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
GRANT EXECUTE ON FUNCTION sigh.f_notice_sem_acento() TO public;

select sigh.f_notice_sem_acento();
PgAdmin recognizes that character and returns the right text, but my application doesn't.

Here is the app code for SetNoticeProcessor:

Code: Select all

procedure pNoticeProcessor(arg: Pointer; AMessage: PAnsiChar); cdecl;
var
	s: string;
begin
	s := AMessage;
	pAviso(s);
end;

procedure TdtmPadrao.pSetNoticeProcessor;
begin
	(dbPadrao.DbcConnection as IZPostgreSQLConnection).GetPlainDriver.SetNoticeProcessor(
		(dbPadrao.DbcConnection as IZPostgreSQLConnection).GetConnectionHandle
		, pNoticeProcessor
		, Self
  );
My database is UTF8 and I'm using Delphi XE2.

Thanks in advance.

Posted: 02.04.2013, 07:53
by marsupilami
Hello Densetsu7,

to me this seems to be some kind of character set conversion problem. Which IDE do you use? (Delphi version / Lazarus)? And what is the setting for TZConnection.ClientCodePage?

Best regards,

Jan

Posted: 02.04.2013, 12:43
by Densetsu7
Delphi XE2.
ClientCodePage is setting to UTF8 automatically, cause there's the following code on the Properties property: "CODEPAGE=UTF8".

Every data and special character conversion works fine. This problem at NoticeProcessor is the only issue that I actually figured out so far.

Thanks in advance.