propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Cannot save/fetch Ñ from ORACLE TABLE #1869

Open redabieradev opened 2 years ago

redabieradev commented 2 years ago

Im working on a new project.

It is docker-ized inside ubuntu server

Im using Propel ORM and PHP Screenshot 2022-04-18 131134

but everytime I save, the saved data in ORACLE table is '¿¿¿¿¿¿'

Can anyone help me please? THANK YOU SO MUCH!!!!

mringler commented 2 years ago

Most likely, this is a problem with your Oracle setup. Have a look at https://stackoverflow.com/a/35150595/4883195

Make sure that the character encoding of your database is set correctly:

select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

Depending on your requirements, this probably should give you AL32UTF8 for Oracle UTF8 or AL16UTF16 for Oracle UTF16.

In the Propel documentation, they set a utf-8 parameter in the config:

propel:
  database:
    connections:
      default:
        adapter: oracle
        settings:
          charset: UTF8

But I am not sure if this works with Oracle (looks like settings-charset triggers a SET NAME query, and I don't think that does much in Oracle).

According to https://stackoverflow.com/a/43224739/4883195, you can add the charset parameter to your connection string, try AL32UTF8 instead of UTF8. Alternatively, you could try to set a server default for NLS_LANG (see https://www.oracle.com/database/technologies/faq-nls-lang.html).

Let me know if any of those work