Sharing is caring

Siegfried Grimbeek
Beerwulf
Published in
3 min readSep 7, 2018

As a developer one often relies on the help of strangers on the internet, this may be through the use of open source software, online forums, surfing Stack Overflow or reading the millions of development articles all over the internet.

Whichever it may be, the development community is an ever encouraging and sharing community, where as opposed to some industries where knowledge is safe guarded and stored behind many passwords, developers tend to share their work and their ideas.

This model not only encourages progress and growth but also saves developers millions of man hours as they do not have to reinvent the wheel or troubleshoot an error themselves, as the chances are that somewhere, someone has ran into the same stumbling block and shared their solution.

As a developer myself, I strive to take part in the open source movement and give back to the development community wherever possible. Fortunately we are in the position, where every so often we have something which we can contribute back to the community.

Strip Accented Characters…

The problem:

In certain countries, user tend to use a lot of accented characters (‘è à á â ę ß î į û œ o ø’), which normally is fine but we discovered that some of our delivery partners had problems with printing labels which contained said accented characters, as their printing software did not allow for this.

This meant that labels were being misprinted which in turn lead to deliveries either going to the wrong address or in some cases the wrong person. The costs of correcting the incorrect deliveries slowly but surely started adding up, to the point that we realised we need to do something about it.

For example, a street address would print as follows:

18 Hënrikô Straße => 18 H�nrik� Stra�e

The completely threw the delivery guys who would then return the package instead of deciphering the address.

The solution:

With development there is always more than one way to skin a cat and after dissecting and discussing the problem, we decided that the best approach was to handle the sanitisation inputs on the frontend.

This way customers would immediately be aware of what happened and we could ensure that before data is persisted to the database it is already in the correct format.

The idea was to sanitise form inputs on the first step of our checkout process, it was not done immediately as a user typed as this seemed rather intrsusive and could lead user to believe that their may be something wrong with their keyboards, so instead we implemented the sanitisation after a user submitted the form.

Now the above example would prints:

18 Hënrikô Straße => 18 Henriko Strasse

Problem solved.

The implementation:

After scouring the internet for existing solutions, we were surprised that there were no out of the box solutions available which we could just plug into our website.

Instead we found several Stack Overflow entries where people had experienced the same problem and other users had provided a couple of answers and suggestions but none of which we were entirely satisfied with.

They were not all bad, but they were out dated, so we took it upon ourselves to develop a solution, which was a module which easily plugs into a website and can be used by anyone. It worked great and was immediately incorporated into our next release.

Once this was done, we repackaged the code into an NPM module and released it under the MIT licence as open source software. The module is available as a download and the source code is available on Github too.

That is our small contribution (more to come) to the open source community.

Please feel free to have a look at the module here and the source code here.

--

--

Siegfried Grimbeek
Beerwulf

Web developer, open source enthusiast and agile evangelist. Currently dreaming big and making things happen @beerwulfwebshop.