I have successfully extracted the base64 encoded header from a Playready DRM manifest.
However, I am encountering an issue when trying to decode the string in Javascript using methods like atob
. There seems to be a missing character square between each expected character.
Interestingly, decoding the encoded string with the command base64 --decode
in a terminal gives me the correct output.
Encoded String:
0gIAAAEAAQ... (omitted for brevity) ...UEA+
base64 -decode
Output:
<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/...
Javascript Decoding Output: ҂Ȃ<WRMHEADER xmlns="ht...
Does anyone know why this discrepancy is happening or how it can be resolved? It appears to be related to the character set being used, but switching to other sets does not solve the issue.
EDIT
It seems that the Javascript output string is displayed correctly here on SO, indicating no issue within my program. Could there be a problem with escaping characters properly? When pasting directly into the editor, it showed up differently: https://i.sstatic.net/LuSim.png
EDIT 2
After the first edit, some strange characters are appearing again on SO.