[New-bugs-announce] [issue25075] issue from python in encode base64 with Json Model
Ramin Farajpour Cami
report at bugs.python.org
Sat Sep 12 01:37:46 CEST 2015
New submission from Ramin Farajpour Cami:
Hi,
issue from python in encode base64 with Json Model in twice encode with base64 output python different with JAVA and C# , if programmer using rest-service in server side and other programmer using UI(Python Django) in client site , this encode different for encode and decode with match json encode model,
real example :
1- go to https://www.base64encode.org/
2- using {"userName":"admin","password":"admin"} (default UTF-8)
3-first encode oupput : "eyJ1c2VyTmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJhZG1pbiJ9"
4-again second encode "eyJ1c2VyTmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJhZG1pbiJ9" output :
"ZXlKMWMyVnlUbUZ0WlNJNkltRmtiV2x1SWl3aWNHRnpjM2R2Y21RaU9pSmhaRzFwYmlKOQ=="
now second output python json model :
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\Matthew F4rr3ll>python
Python 2.7.7 (default, Jun 1 2014, 14:21:57) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> s1='{"userName":"admin","password":"admin"}'
>>> s2 = s1.encode("base64")
>>> e = s2.encode("base64")
>>> print e
ZXlKMWMyVnlUbUZ0WlNJNkltRmtiV2x1SWl3aWNHRnpjM2R2Y21RaU9pSmhaRzFwYmlKOQo=
>>>
>>>
>>>
now check this output :
ZXlKMWMyVnlUbUZ0WlNJNkltRmtiV2x1SWl3aWNHRnpjM2R2Y21RaU9pSmhaRzFwYmlKOQo=
ZXlKMWMyVnlUbUZ0WlNJNkltRmtiV2x1SWl3aWNHRnpjM2R2Y21RaU9pSmhaRzFwYmlKOQ==
you see in two encode different in end line in ("o=" != "==")
also i know resolve this but you should fix in end line encode match with other language
Thanks,
Ramin
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 250502
nosy: Ramin Farajpour Cami
priority: normal
severity: normal
status: open
title: issue from python in encode base64 with Json Model
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25075>
_______________________________________
More information about the New-bugs-announce
mailing list