hungtv
March 27, 2015, 5:36pm
1
I want to get XLF content and save it as .xlf file. I use MD5 to check the file integrity. Everything works fine if I don’t add UTF-8 text in design.
This is the way I check the file integrity:
Get Base64 code from CMS
Decode Base64 to get byteArray
Create MD5 from byteArray
Compare with MD5 from RequiredFileResponse
So how can I get true XLF and use UTF-8 for design?
dan
March 27, 2015, 6:16pm
2
You need to make sure that when you decode you are doing so in the correct encoding. All content from the CMS should be UTF-8 encoded.
If you can share some code we might be able to comment further.
hungtv
March 29, 2015, 4:20am
3
Thank you so much. I’ve found problem in my decode function. It’s return a string instead of byteArray (Uint8Array). I use this library to decode base64 to byteArray:
/*
Copyright (c) 2011, Daniel Guerrero
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DANIEL GUERRERO BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
This file has been truncated. show original