Wrong encoding of names

Our tests fail when trying to register a patient with a name with diacritics e.g. Mário. The name is incorrectly displayed on the patient dashboard as Mário.

See screencast at https://saucelabs.com/tests/35eaf2be5d004d08a2e1e29e2af5af23

@adamg, tried to fix it, but with no avail. Adam, could you please share what you discovered so far?

Does anyone have any clue what might be causing the issue?

We’ve had some real issues with character encoding in the past. Generally, fixing Tomcat and mysql settings seem to fix the issue. However, there are still some servers of ours that still have this issue, despite all the settings, and we’ve never been able to find where the problem is.

Looking at our setup scripts, this where I see us setting UTF-8:


connection.url=jdbc:mysql://localhost:3306/<%= @openmrs_db %>?autoReconnect=true&sessionVariables=storage_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8


<Connector port="8009" address="" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>





Are tests done against H2 db? If so, are we setting the collation to UTF8 before creating tables?

I’ve done first two things @mogoodrich suggested but missed editing my.cnf file. I will try it and give you an update :slight_smile: I have create an issue for this here

@burke, UI tests run against MySQL in a docker container.

@mogoodrich, thanks for your suggestions!

@adamg, please follow up on this thread once you get a chance to fix my.cnf file.

@raff The PR is here. It seems that modifying my.cnf file is not needed. I had to only set UREncoding in servel.xml. I’m not sure why it didn’t work when I was doing this for the first time. I have tested it with locally installed mysql and with docker image created with build-distro task so it should work on travis CI

1 Like

@adamg, thanks!

I’ve merged it, but we’ll need to release the SDK to confirm it fixed the issue on CI.

Do you feel the SDK is in releasable state now? If yes, then please go ahead and do the release. I’m still a bit behind of what’s been going on over the last 2 weeks.

I’ve released SDK 3.4.0. I will test today’s fix asap :slight_smile:

@adamg was this supposed to fix https://ci.openmrs.org/browse/REFAPP-DUT/latest?

@dkayiwa I’m investigating what happened. I will give you an update ASAP

EDIT: Test started failing on SauceLabs yesterday so it is not caused by today’s SDK release. @raff Do you have any ideas what might be the cause of this ?

@adamg, it does have something to do with your change… see https://travis-ci.org/openmrs/openmrs-distro-referenceapplication/builds/167203517#L5583

 ---> Running in 110f3260c82f
sed: -e expression #1, char 25: unknown command: `U'
ERROR: Service 'openmrs-referenceapplication' failed to build: The command '/bin/sh -c sed '/Connector port="8080"/ URIEncoding="UTF-8"' /usr/local/tomcat/conf/server.xml' returned a non-zero code: 1

Ok, fixed it. I will draft a new release once Travis build is finished

I didn’t realized that docker wasn’t building my latest config. It was using the cached one instead so I didn’t get any errors. This is how the sed command should look.

sed -i ‘/Connector port=“8080”/a URIEncoding=“UTF-8”’ /usr/local/tomcat/conf/server.xml

EDIT: here you can see passing test with diactricts

1 Like