Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#801 closed defect (fixed)

[PATCH] OsmConnection assumes ASCII strings for authentication

Reported by: danilo@… Owned by: framm
Priority: major Milestone:
Component: Core Version: latest
Keywords: authentication, utf-8 Cc:


Being the i18n guy that I am, I push all the technologies to their max, and I chose "Данило" (Cyrillic Danilo) for my username on OpenStreetMap.

This caused problems with JOSM when authenticating (for HTTP Basic Authentication), because Base64.encode used assumed that a string it was passed was consisted of 8-bit safe Unicode characters, however Cyrillic is outside this range (0x400–0x47f).

To fix this, I downloaded JOSM from SVN and first CharsetEncoder.encode()d the username and password, and passed that to an almost identical implementation of Base64.encode() but which takes ByteBuffer as a parameter.

My Java coding is certainly lacking (I've only rarely do some), and even stylistically, I could not figure out if there was any coding standard in use (spaces and tabs are used interchangeably in the sourcecode). Also, if this was code I would be maintaining, I'd remove the Base64.encode(String) method, because that one is easily misused (maybe make it Base64.encode(String, String charset) instead?)

However, the attached patch made it possible for me to upload changes to OSM server.

This bug is a "blocker" for me, but I've left it as the default "major" priority, because I suspect you determine priority based on other criteria as well.

Attachments (1)

josm-utf8-logins.patch (3.9 KB) - added by danilo@… 11 years ago.
UTF-8 support for authentication

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by danilo@…

Attachment: josm-utf8-logins.patch added

UTF-8 support for authentication

comment:1 Changed 11 years ago by anonymous

Summary: OsmConnection assumes ASCII strings for authentication[PATCH] OsmConnection assumes ASCII strings for authentication

comment:2 Changed 11 years ago by framm

Resolution: fixed
Status: newclosed

Patch applied in r662. Please note that I am exactly of the opposite mindset - instead of "pushing technologies to the max" in order to run into as many problems as possible, I tend to *still* write all my e-mails in 7-bit ASCII even though my native language would normally require at least latin-1. If it is possible to have JOSM support fancy usernames without trouble then there is nothing to say against your patch but if it causes any problems for those who don't "push technologies to the max" and just want to get on with their work, then we'll have to revert it ;-)

comment:3 Changed 11 years ago by danilo@…

Hi framm, thanks for applying the patch. I suspect nobody will have problems with the patch, because previously it worked correctly for anything in Latin-1, and now it works for Latin-1 and entire UTF-8 supported range.

Of course, I'd be happy to help debug and solve the problems anyone runs into, since now I'm already addicted to OSM and JOSM in particular :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain framm.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.