[6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

[6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Tue 08 Sep 2015 07:27

Hello,

I'm getting a lot of errors such this one ! How can I debug this ?

Code: Select all

exception class    : EUniError
exception message  : invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

main thread ($1158):
008b3487 +027 gestion_multicn.exe Uni                      HandleInternalError
008b7593 +037 gestion_multicn.exe Uni                      TCustomUniDataSet.InternalExecute
772171c6 +081 ntdll.dll                                    RtlRaiseStatus
77217052 +00a ntdll.dll                                    KiUserExceptionDispatcher
00c5e156 +01a gestion_multicn.exe PgClassesUni             TPgSQLCommand.PerformBindExecute
00c5e2f0 +15c gestion_multicn.exe PgClassesUni             TPgSQLCommand.InternalExecute
00c5d763 +027 gestion_multicn.exe PgClassesUni             TPgSQLCommand.Execute
0089af9c +010 gestion_multicn.exe CRAccess                 TCRRecordSet.ExecCommand
00c5ef78 +104 gestion_multicn.exe PgClassesUni             TPgSQLRecordSet.ExecCommand
0086b154 +008 gestion_multicn.exe DBAccess                 TCustomDADataSet.InternalExecute
008b757f +023 gestion_multicn.exe Uni                      TCustomUniDataSet.InternalExecute
0086b4ec +258 gestion_multicn.exe DBAccess                 TCustomDADataSet.Execute
00996120 +288 gestion_multicn.exe MultiCN          753 +36 TMultiCN.Archiver_Poste
0099dd58 +130 gestion_multicn.exe MultiCN         2081 +38 TMultiCN.SetPoste
00d2feaa +09a gestion_multicn.exe fmPoste          110 +21 TfrmPoste.BtDebutPosteClick
005be0bf +073 gestion_multicn.exe Vcl.Controls             TControl.Click
005e1d7e +01e gestion_multicn.exe Vcl.StdCtrls             TCustomButton.Click
006edd11 +0a5 gestion_multicn.exe Vcl.Buttons              TBitBtn.Click
005e288c +010 gestion_multicn.exe Vcl.StdCtrls             TCustomButton.CNCommand
005bdb51 +2bd gestion_multicn.exe Vcl.Controls             TControl.WndProc
005c26f9 +5e9 gestion_multicn.exe Vcl.Controls             TWinControl.WndProc
005e1a28 +06c gestion_multicn.exe Vcl.StdCtrls             TButtonControl.WndProc
005bd78c +024 gestion_multicn.exe Vcl.Controls             TControl.Perform
005c285f +023 gestion_multicn.exe Vcl.Controls             DoControlMsg
005c32e7 +00b gestion_multicn.exe Vcl.Controls             TWinControl.WMCommand
005bdb51 +2bd gestion_multicn.exe Vcl.Controls             TControl.WndProc
005c26f9 +5e9 gestion_multicn.exe Vcl.Controls             TWinControl.WndProc
005c1d18 +02c gestion_multicn.exe Vcl.Controls             TWinControl.MainWndProc
0053fbc0 +014 gestion_multicn.exe System.Classes           StdWndProc
76dd557d +044 USER32.dll                                   SendMessageW
76dd1b52 +016 USER32.dll                                   CallWindowProcW
005c280a +0e6 gestion_multicn.exe Vcl.Controls             TWinControl.DefaultHandler
005be514 +010 gestion_multicn.exe Vcl.Controls             TControl.WMLButtonUp
005bdb51 +2bd gestion_multicn.exe Vcl.Controls             TControl.WndProc
005c26f9 +5e9 gestion_multicn.exe Vcl.Controls             TWinControl.WndProc
005e1a28 +06c gestion_multicn.exe Vcl.StdCtrls             TButtonControl.WndProc
005c1d18 +02c gestion_multicn.exe Vcl.Controls             TWinControl.MainWndProc
0053fbc0 +014 gestion_multicn.exe System.Classes           StdWndProc
76ddcc6b +00a USER32.dll                                   DispatchMessageW
006cd8b3 +0f3 gestion_multicn.exe Vcl.Forms                TApplication.ProcessMessage
006cd8f6 +00a gestion_multicn.exe Vcl.Forms                TApplication.HandleMessage
006cdc29 +0c9 gestion_multicn.exe Vcl.Forms                TApplication.Run
00d72700 +16c gestion_multicn.exe Gestion_MultiCN   55 +20 initialization
76eded5a +010 kernel32.dll                                 BaseThreadInitThunk

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by azyk » Tue 08 Sep 2015 08:57

To avoid the error, try to set the TUniConnection.SpecificOptions.Values['PostgreSQL.UseUnicode'] property to 'True'.

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by FCS » Tue 08 Sep 2015 13:00

Hello,

For PostgreSQL you can set the default decoding by

UniConnection1.SpecificOptions.Values['Charset']:='WIN1250'

For me this converts UTF (database char set) to CP 1250 (Polish language client char set).

Regards
Michal

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Tue 08 Sep 2015 14:34

Hello,

I've already set unicode to true :

Code: Select all

  FConnection.SpecificOptions.Values['PostgreSQL.ConnectionTimeout=5'];
  FConnection.SpecificOptions.Values['PostgreSQL.UseUnicode=True'];
Here is my database settings

Code: Select all

CREATE DATABASE dodo
  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'French_France.1252'
       LC_CTYPE = 'French_France.1252'
       CONNECTION LIMIT = -1;
@FCS : I'll try this instead
UniConnection1.SpecificOptions.Values['Charset']:='WIN1252'

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Wed 09 Sep 2015 14:00

I'm still getting this error even setting the charset.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Wed 09 Sep 2015 15:43

I really need devart help on this !

Method Archiver_Plateau is raising "invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75." (while Sauver_PlateauEnCours is always working).

Software is running on 6 Windows 7 SP1 workstation. All these workstation are running 32bit PostgreSQL 9.4.4 server. Software is failling on two workstation only (one running a x68 os, the other an x64 os)

Here is th DML for table public.productions_plateaux (working) and public.productions_plateaux_details (exception)

Code: Select all

CREATE TABLE public.productions_plateaux_details (
  id_production_plateau_detail SERIAL,
  ordre_fabrication VARCHAR(6) DEFAULT ''::character varying,
  ligne VARCHAR(10) DEFAULT ''::character varying,
  date_poste DATE,
  plateau VARCHAR(50) DEFAULT ''::character varying,
  date_entree_plateau TIMESTAMP WITHOUT TIME ZONE,
  date_sortie_plateau TIMESTAMP WITHOUT TIME ZONE,
  compteur_plateau INTEGER DEFAULT 0,
  compteur_produit INTEGER DEFAULT 0,
  id_poste INTEGER,
  id_pilote_1 VARCHAR(10) DEFAULT ''::character varying,
  id_pilote_2 VARCHAR(10) DEFAULT ''::character varying,
  CONSTRAINT productions_plateaux_details_pkey PRIMARY KEY(id_production_plateau_detail)
) 
WITH (oids = false);

CREATE INDEX productions_plateaux_details_date_sortie_plateau ON public.productions_plateaux_details
  USING btree (date_sortie_plateau);

CREATE INDEX productions_plateaux_details_ligne ON public.productions_plateaux_details
  USING btree (ligne COLLATE pg_catalog."default");

CREATE INDEX productions_plateaux_details_ordre_fabrication ON public.productions_plateaux_details
  USING btree (ordre_fabrication COLLATE pg_catalog."default");

CREATE INDEX productions_plateaux_details_poste_pilote ON public.productions_plateaux_details
  USING btree (id_poste, id_pilote_1 COLLATE pg_catalog."default", id_pilote_2 COLLATE pg_catalog."default");

CREATE TABLE public.productions_plateaux (
  ordre_fabrication VARCHAR(6) DEFAULT ''::character varying NOT NULL,
  ligne VARCHAR(10) DEFAULT ''::character varying NOT NULL,
  date_poste DATE,
  plateau VARCHAR(50) DEFAULT ''::character varying NOT NULL,
  date_entree_plateau TIMESTAMP WITHOUT TIME ZONE,
  compteur_plateau INTEGER DEFAULT 0,
  compteur_produit INTEGER DEFAULT 0,
  id_poste INTEGER,
  id_pilote_1 VARCHAR(10) DEFAULT ''::character varying,
  id_pilote_2 VARCHAR(10) DEFAULT ''::character varying,
  CONSTRAINT productions_plateaux_pkey PRIMARY KEY(ordre_fabrication, ligne)
) 
WITH (oids = false);

CREATE INDEX productions_plateaux_ligne ON public.productions_plateaux
  USING btree (ligne COLLATE pg_catalog."default");

CREATE INDEX productions_plateaux_plateau ON public.productions_plateaux
  USING btree (plateau COLLATE pg_catalog."default");
Here is code compiled with Delphi XE8 Update 1

Code: Select all

Const 
 Plateau_En_Cours =
    'SELECT Ordre_Fabrication,Ligne,Plateau,Ligne,date_poste,Date_Entree_Plateau,Compteur_Plateau,Compteur_Produit FROM Productions_Plateaux WHERE Ligne = :Ligne LIMIT 1;';
  Plateau_Insert =
    'INSERT {if SQLITE} OR IGNORE {endif} INTO Productions_Plateaux (Ordre_Fabrication,Ligne,date_poste,Date_Entree_Plateau,Plateau,Compteur_Plateau,Compteur_Produit,Id_Poste,Id_Pilote_1,Id_Pilote_2) '
    + ' VALUES (:Ordre_Fabrication,:Ligne,:date_poste,:Date_Entree_Plateau,:Plateau,:Compteur_Plateau,:Compteur_Produit,:Id_Poste,:Id_Pilote_1,:Id_Pilote_2);';
  Plateau_Update =
    'Update Productions_Plateaux set Ordre_Fabrication=:Ordre_Fabrication,' +
    'date_poste=:date_poste,Plateau=:Plateau,Compteur_Plateau=:Compteur_Plateau,Compteur_Produit=:Compteur_Produit,Id_Poste=:Id_Poste,Id_Pilote_1=:Id_Pilote_1,Id_Pilote_2=:Id_Pilote_2 where Ligne=:Ligne;';
  Plateau_Archive = 'INSERT INTO Productions_Plateaux_Details' + #13#10 +
    '    (Ordre_Fabrication,Ligne,date_poste,Plateau,Date_Entree_Plateau,Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,Id_Poste,Id_Pilote_1,Id_Pilote_2)'
    + #13#10 + 'SELECT' + #13#10 +
    '    Ordre_Fabrication,Ligne,:date_poste,Plateau,Date_Entree_Plateau,:Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,:Id_Poste,:Id_Pilote_1,:Id_Pilote_2'
    + #13#10 + 'FROM' + #13#10 + 'Productions_Plateaux' + #13#10 +
    'Where Ligne = :Ligne;';
  Plateau_Delete = 'DELETE' + #13#10 + 'FROM' + #13#10 + 'Productions_Plateaux'
    + #13#10 + 'Where Ligne = :Ligne ;';

...

constructor TMultiCN.Create(aOwner: TComponent);
var
begin
  inherited;
  //....
  FInternalConnection := Tuniconnection.Create(nil);
end;

destructor TMultiCN.Destroy;
var
  i: Integer;
begin
  inherited;
  FInternalConnection.Free;
end;

//Before running our thread, we set DB connection
procedure TMultiCN.SetConnection(const Value: Tuniconnection);
begin
  if Value.ProviderName = 'SQLite' then
  Begin
    //We keep the same connection object or we will get "Database is locked errors"
    FConnection := Value;
  End
  else
  Begin
    //Using our Connection created into our thread instead...
    FConnection := FInternalConnection;
    FConnection.Disconnect;
    //Setting Connection properties
    FConnection.ProviderName := Value.ProviderName;
    FConnection.Server := Value.Server;
    FConnection.Port := Value.Port;
    FConnection.Username := Value.Username;
    FConnection.Password := Value.Password;
    FConnection.LoginPrompt := Value.LoginPrompt;
    FConnection.Database := Value.Database;
  End;
  FConnection.SpecificOptions.Values['SQLite.BusyTimeout=5000'];
  FConnection.SpecificOptions.Values['SQLite.EnableSharedCache=True'];
  FConnection.SpecificOptions.Values['SQLite.UseUnicode=True'];
  FConnection.SpecificOptions.Values['SQLite.Direct=True'];
  FConnection.SpecificOptions.Values['SQLite.ReadUncommitted=True'];

  FConnection.SpecificOptions.Values['PostgreSQL.ConnectionTimeout=5'];
  FConnection.SpecificOptions.Values['PostgreSQL.UseUnicode=True'];
  FConnection.SpecificOptions.Values['PostgreSQL.Charset=WIN1252'];
end;
procedure TMultiCN.Archiver_Plateau(Delete: Boolean);
var
  FUniQuery: TuniQuery;
begin
  FUniQuery := TuniQuery.Create(nil);
  FUniQuery.Connection := FConnection;

  try
    FUniQuery.SpecificOptions.Values['PostgreSQL.UseParamTypes'] := 'True';
    FUniQuery.SQL.Text := Plateau_Archive;

    FUniQuery.ParamByName('Ligne').DataType := ftString;
    FUniQuery.ParamByName('Date_Sortie_Plateau').DataType := ftDateTime;
    FUniQuery.ParamByName('Id_Poste').DataType := ftinteger;
    FUniQuery.ParamByName('Date_Poste').DataType := ftDate;
    FUniQuery.ParamByName('Id_Pilote_1').DataType := ftString;
    FUniQuery.ParamByName('Id_Pilote_2').DataType := ftString;

    FUniQuery.ParamByName('Ligne').AsString := FLigne.Id_ligne;
    FUniQuery.ParamByName('Date_Sortie_Plateau').AsDateTime :=
      FPlateau.Date_Sortie_Plateau;
    FUniQuery.ParamByName('Id_Poste').AsInteger := FPoste.Id_Poste;
    FUniQuery.ParamByName('Date_Poste').AsDate := FPoste.Date_Poste;
    FUniQuery.ParamByName('Id_Pilote_1').AsString := FPoste.Id_Pilote_1;
    FUniQuery.ParamByName('Id_Pilote_2').AsString := FPoste.Id_Pilote_2;

    if not FConnection.InTransaction then
      FConnection.StartTransaction;
    try
      FUniQuery.Prepare;
      // Do some actions with database. For example:
      FUniQuery.Execute;
      // Commit the current transaction to reflect changes in database if no errors were raised
      FConnection.Commit;
    except
      // Rollback all changes in database made after StartTransaction if an error was raised
      FConnection.Rollback;
      HandleException;
    end;

    if Delete then
    begin
      FUniQuery.SQL.Text := Plateau_Delete;
      FUniQuery.ParamByName('Ligne').DataType := ftString;
      FUniQuery.ParamByName('Ligne').AsString := FLigne.Id_ligne;

      if not FConnection.InTransaction then
        FConnection.StartTransaction;
      try
        FUniQuery.Prepare;
        // Do some actions with database. For example:
        FUniQuery.Execute;
        // Commit the current transaction to reflect changes in database if no errors were raised
        FConnection.Commit;
      except
        // Rollback all changes in database made after StartTransaction if an error was raised
        FConnection.Rollback;
        HandleException;
      end;
    end;

  finally
    FUniQuery.Free;
  end;
  Archiver_Plateau_CSV;
end;

procedure TMultiCN.Sauver_PlateauEnCours(const Value: TPlateau);
var
  FUniQuery: TuniQuery;
begin
  FUniQuery := TuniQuery.Create(nil);
  FUniQuery.Connection := FConnection;
  try
    FUniQuery.SpecificOptions.Values['PostgreSQL.UseParamTypes'] := 'True';
    FUniQuery.SQL.Text := Plateau_Update;

    FUniQuery.ParamByName('Ligne').DataType := ftString;
    FUniQuery.ParamByName('Ordre_Fabrication').DataType := ftString;
    FUniQuery.ParamByName('Compteur_Produit').DataType := ftinteger;
    FUniQuery.ParamByName('Plateau').DataType := ftString;
    FUniQuery.ParamByName('Id_Poste').DataType := ftinteger;
    FUniQuery.ParamByName('Date_Poste').DataType := ftDate;
    FUniQuery.ParamByName('Id_Pilote_1').DataType := ftString;
    FUniQuery.ParamByName('Id_Pilote_2').DataType := ftString;
    FUniQuery.ParamByName('Compteur_Plateau').DataType := ftinteger;

    FUniQuery.ParamByName('Ligne').AsString := FLigne.Id_ligne;
    FUniQuery.ParamByName('Ordre_Fabrication').AsString :=
      FOrdre_Fabrication_En_Cours.Ordre_Fabrication;
    FUniQuery.ParamByName('Compteur_Produit').AsInteger :=
      FOrdre_Fabrication_En_Cours.Compteur_Produit;
    FUniQuery.ParamByName('Plateau').AsString := Value.Nom_Plateau;

    FUniQuery.ParamByName('Id_Poste').AsInteger := FPoste.Id_Poste;
    FUniQuery.ParamByName('Date_Poste').AsDate := FPoste.Date_Poste;
    FUniQuery.ParamByName('Id_Pilote_1').AsString := FPoste.Id_Pilote_1;
    FUniQuery.ParamByName('Id_Pilote_2').AsString := FPoste.Id_Pilote_2;

    FUniQuery.ParamByName('Compteur_Plateau').AsInteger :=
      Value.Compteur_Plateau;

    if not FConnection.InTransaction then
      FConnection.StartTransaction;
    try
      FUniQuery.Prepare;
      // Do some actions with database. For example:
      FUniQuery.Execute;
      // Commit the current transaction to reflect changes in database if no errors were raised
      FConnection.Commit;
    except
      // Rollback all changes in database made after StartTransaction if an error was raised
      FConnection.Rollback;
      HandleException;
    end;

    if FUniQuery.RowsAffected = 0 then
    begin
      FUniQuery.SQL.Text := Plateau_Insert;
      FUniQuery.ParamByName('Date_Entree_Plateau').DataType := ftDateTime;
      FUniQuery.ParamByName('Ligne').DataType := ftString;
      FUniQuery.ParamByName('Ordre_Fabrication').DataType := ftString;
      FUniQuery.ParamByName('Compteur_Produit').DataType := ftinteger;
      FUniQuery.ParamByName('Plateau').DataType := ftString;
      FUniQuery.ParamByName('Id_Poste').DataType := ftinteger;
      FUniQuery.ParamByName('Date_Poste').DataType := ftDate;
      FUniQuery.ParamByName('Id_Pilote_1').DataType := ftString;
      FUniQuery.ParamByName('Id_Pilote_2').DataType := ftString;
      FUniQuery.ParamByName('Compteur_Plateau').DataType := ftinteger;

      FUniQuery.ParamByName('Date_Entree_Plateau').AsDateTime :=
        Value.Date_Entree_Plateau;
      FUniQuery.ParamByName('Ligne').AsString := FLigne.Id_ligne;
      FUniQuery.ParamByName('Ordre_Fabrication').AsString :=
        FOrdre_Fabrication_En_Cours.Ordre_Fabrication;
      FUniQuery.ParamByName('Compteur_Produit').AsInteger :=
        FOrdre_Fabrication_En_Cours.Compteur_Produit;
      FUniQuery.ParamByName('Plateau').AsString := Value.Nom_Plateau;

      FUniQuery.ParamByName('Id_Poste').AsInteger := FPoste.Id_Poste;
      FUniQuery.ParamByName('Date_Poste').AsDate := FPoste.Date_Poste;
      FUniQuery.ParamByName('Id_Pilote_1').AsString := FPoste.Id_Pilote_1;
      FUniQuery.ParamByName('Id_Pilote_2').AsString := FPoste.Id_Pilote_2;

      FUniQuery.ParamByName('Compteur_Plateau').AsInteger :=
        Value.Compteur_Plateau;

      if not FConnection.InTransaction then
        FConnection.StartTransaction;
      try
        FUniQuery.Prepare;
        // Do some actions with database. For example:
        FUniQuery.Execute;
        // Commit the current transaction to reflect changes in database if no errors were raised
        FConnection.Commit;
      except
        // Rollback all changes in database made after StartTransaction if an error was raised
        FConnection.Rollback;
        HandleException;
      end;
    end;

  finally
    FUniQuery.Free;
  end;
end;
Here is DBMonitor output :

Code: Select all

SQL Tab
INSERT INTO Productions_Plateaux_Details
    (Ordre_Fabrication,Ligne,date_poste,Plateau,Date_Entree_Plateau,Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,Id_Poste,Id_Pilote_1,Id_Pilote_2)
SELECT
    Ordre_Fabrication,Ligne,:date_poste,Plateau,Date_Entree_Plateau,:Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,:Id_Poste,:Id_Pilote_1,:Id_Pilote_2
FROM
Productions_Plateaux
Where Ligne = :Ligne;

Parameter Tab
date_poste                    date                       09/09/2015
Date_Sortie_Plateau    datetime                 09/09/2015 17:45:58
Id_Poste                       integer                    2
Id_Pilote_1                   widestring[2]           '26'
Id_Pilote_2                   widestring[2]           '52'
Ligne                            widestring[8]           'PIC PIC 3'



Error Tab
invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by FCS » Wed 09 Sep 2015 17:01

Hello,

Try to find the string field containing the chars: 0xe9 0x71 0x75.

In my opinion the problem is on the char 0xe9.

I had similar problems inserting polish letters into char/varchar fields, but I'm still using BDS2006.

The first solution is converting strings (no utf) to utf strings using function like AnsiToUtf8

Finally I set the client charset:
UniConnection1.SpecificOptions.Values['Charset']:='WIN1250'
and I have
UniConnection1.SpecificOptions.Values['PostgreSQL.UseUnicode=False'];
and I don't convert strings to UTF8

Check if you don't have AnsiString variables, which values are used in Insert operations. Delphi after 2007 in background converts ansiStrings to/from strings=UTF Strings. Maybe here the problem is.

Regards
Michal

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Thu 10 Sep 2015 08:23

Hi Mickael,

Thank you for your kind help.
I've just checked my project and I don't have any AnsiString nor AnsiChar variables / properties / fields. Everything is stored in String or Char variables.

Unicode "0xe9" "0x7" "0x75" chars correspond to "é" "q" "u" chars. Looks like "équ" string is somehow sent to the server... Problem is that I do not send a string starting, ending or having these chars !

When you look at DBMonitor :

SQL

Code: Select all

INSERT INTO Productions_Plateaux_Details
(Ordre_Fabrication,Ligne,date_poste,Plateau,Date_Entree_Plateau,Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,Id_Poste,Id_Pilote_1,Id_Pilote_2)
SELECT
Ordre_Fabrication,Ligne,:date_poste,Plateau,Date_Entree_Plateau,:Date_Sortie_Plateau,Compteur_Plateau,Compteur_Produit,:Id_Poste,:Id_Pilote_1,:Id_Pilote_2
FROM  Productions_Plateaux  Where Ligne = :Ligne;
Parameters passed

Code: Select all

date_poste                    date                       09/09/2015
Date_Sortie_Plateau    datetime                 09/09/2015 17:45:58
Id_Poste                       integer                    2
Id_Pilote_1                   widestring[2]           '26'
Id_Pilote_2                   widestring[2]           '52'
Ligne                            widestring[8]           'PIC PIC 3'
Error

Code: Select all

invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75
You can see that these characters aren't used !
More, this is well working on 4 other workstations !

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by FCS » Thu 10 Sep 2015 09:07

Hello,

Perhaps the problem lies in the configuration of the two computers.

Check the Regional Settings in the Control Panel. Perhaps date / time format or decimal character is different.

I do not use capital letters in the names of fields used in the database PosgreSQL.
As I remember using capital letters, the field names must be enclosed in quotation marks, for example:
Ligne -> "Ligne"

It is also possible that one of the fields in the SELECT statement is NULL, and the table to which you add data fields are not NULL.

Execute the command:

SELECT
Ordre_Fabrication,
Ligne,
: date_poste,
plateau,
Date_Entree_Plateau,
: Date_Sortie_Plateau,
Compteur_Plateau,
Compteur_Produit,
: Id_Poste,
: Id_Pilote_1,
: Id_Pilote_2

and see what it returns.

It is possible that on other computers this SELECT statement returns other values, so there is no problem.

Regards
Michal

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Thu 10 Sep 2015 11:04

Michal,

You are right about capitalization. In my case all tables and fields haven't any capitalized character.
I've checked to set useunicode to false but this neither helps.

I forgot to tell you that PostgreSQL 9.4.4 is installed on each workstation (data need to be locally stored in case of network failure... production must go on...).

Anyone from Depart is lurking here ? I badly need advices...

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Thu 10 Sep 2015 14:39

Regionals settings are all the same...

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by FCS » Thu 10 Sep 2015 15:26

Hello,

Maybe here is problem:

Ligne widestring[8] 'PIC PIC 3' = length is 9 not 8

Regards
Michal

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Thu 10 Sep 2015 17:43

I guess you have pointed the issue out.

This is also reproducible with latest unidac version !!!

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by swierzbicki » Fri 11 Sep 2015 08:33

I've sent an reproducible test case...
I've red that starting PostgreSQL 9.4.4 , UTF8 check are more strict !

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: [6.1.6 / PostgreSQL] Invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75.

Post by azyk » Fri 11 Sep 2015 11:44

Thank you for the example. We have reproduced the described error and will investigate it. We will notify you about the results as any are available.

Post Reply