Cannot search special characters like ß in Name

Description

Hi, trying to search a product by Name with ß in the search string doesn't work.

Found the issue is caused by the difference between postgresql UPPER vs java toUpperCase function.

  • Name = Faß

  • postgresql -> SELECT UPPER(Name) = FAß

  • java -> "Faß%".toUpperCase = FASS%

A possible solution can be to use LOWER instead of UPPER - but maybe that could affect other languages?

Also, noticed that the default Locale is not set according to the login language, but the client computer.
the following patch could solve that problem:

diff -r 1a13f737c3b0 org.adempiere.base/src/org/compiere/util/Login.java --- a/org.adempiere.base/src/org/compiere/util/Login.java Wed Dec 27 15:59:07 2017 +0100 +++ b/org.adempiere.base/src/org/compiere/util/Login.java Fri Dec 29 15:57:01 2017 +0100 @@ -773,6 +773,14 @@ if (AD_Client_ID != 0 && MSysConfig.getBooleanValue(MSysConfig.SYSTEM_IN_MAINTENANCE_MODE, false, AD_Client_ID)) return Msg.getMsg(m_ctx, "SystemInMaintenance"); } + + // Language + String langName = Env.getAD_Language(m_ctx); + Language language = Language.getLanguage(langName); + Language.setLoginLanguage(language); + Env.verifyLanguage (m_ctx, language); + Locale loc = language.getLocale(); + Locale.setDefault(loc); return null; } // validateLogin

Environment

None

relates to

Activity

Show:

Carlos Ruiz May 24, 2018 at 3:37 PM

Thanks , I think I found a good fix with
https://bitbucket.org/idempiere/idempiere/commits/f2c01d6

Fixed also the Info Window that was not working.

I think the unaccent would not solve the problem because it was caused by mismatch between the java toUppercase function and the database function UPPER.

Regards,

Carlos Ruiz

Ricardo Alexsander Santana May 24, 2018 at 2:05 PM

We have a similar problem with some special characters in Portuguese language. We are planning to use the unaccent function in Postgres. I've made some tests I think it can be used with ß as well using Postgres 9.6+.

First you need to enable the UNACCENT extension:

CREATE EXTENSION UNACCENT;

If you run the query:

SELECT 'ß' AS Text, UNACCENT('ß') AS Unaccent;

The result will be:

Text | Unaccent ---------------- ß | ss

If you are running Postgres 9.5 or lower the result is different:

Text | Unaccent ---------------- ß | s

I've not tested but based on the article below, I found that Oracle has a similar function with same results, maybe we could change the FindWindow.java and solve both cases. WDYT?

https://community.oracle.com/thread/1117030

Fixed

Details

Assignee

Reporter

Priority

Created December 29, 2017 at 2:57 PM
Updated July 23, 2018 at 6:50 PM
Resolved May 24, 2018 at 3:37 PM