This can be done similarly to java, but encoding the element before and comparing the result. Imported from Jira [BEAM-677](https://issues.apache.org/jira/browse/BEAM-677). Original Jira may contain additional context. Reported by: robertwb.