Problem with Base64 encode

0 votes

I am using user service from app42 and i want user names to be in utf-8. So i encode user names using Base64. Everything works fine but sometimes i have this error "Unexpected < encountered" with certain user names. For instance when im trying to get user with encoded name "0JvQntCg0J/QkA==" in getUserDoneListener i have this error. I guess that problem in slash(/). So should i replace it with another symbol or there should be another workaround ? I am using flahs sdk.

asked May 6, 2014 in App42 Cloud API-BaaS by makskamyshnikov (10 points)
recategorized Oct 26, 2014 by sushil

1 Answer

0 votes
Yes, '/' is causing the error. Username should not have , ; / \
You should escape the string after encoding to base64.
answered May 6, 2014 by Suyash Mohan (900 points)
reshown May 7, 2014 by Suyash Mohan
ok now when im using escape on my encoded string i have "0JvQntCg0J%2FQkA==" and there is another error from getUserDoneListener "Unexpected end of input"
Can you post code snippet?

I use getUser method from user service to check is username unique. If callback on this function return App42NotFoundException there is no such user then. But now when i encode some username and then use URI.escapeChars i have "0JvQntCg0J%2FQkA==" as result. And when i pass this string as parameter to getUser function, i always get exception with message "Unexpected end of input"
I've just tested createUser method with name "0JvQntCg0J%2FQkA%3D%3D" and it was successfully created. But when i use getUser method with same name it still return exception with message "Unexpected end of input".
Is "%" allowed in getUser request ?
% is not allowed in any get and delete request.
Ok thanks. I replaced % with @ after escape string and it worked.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on