Replaced btoa and atob that have a problem with handling Unicode caharacters with code by Johan Sundström.