#include "uhash.h"
#include "uresimp.h"
#include "unicode/ustring.h"
+#include "unicode/utf8.h"
void res_write_java(struct SResource *res,UErrorCode *status);
memset(buf,0,length);
bufLen = uCharsToChars(buf,length,src,srcLen,status);
-
+ // buflen accounts for extra bytes added due to multi byte encoding of
+ // non ASCII characters
if(printEndLine)
write_tabs(out);
}
}
T_FileStream_write(out,"\"",1);
+ uint32_t byteIndex = 0;
+ uint32_t trailBytes = 0;
if(len+add<bufLen){
+ // check the trail bytes to be added to the output line
+ while (byteIndex < add) {
+ if (U8_IS_LEAD(*(current + byteIndex))) {
+ trailBytes = U8_COUNT_TRAIL_BYTES(*(current + byteIndex));
+ add += trailBytes;
+ }
+ byteIndex++;
+ }
T_FileStream_write(out,current,add);
- T_FileStream_write(out,"\" +\n",4);
- write_tabs(out);
+ if (len + add < bufLen) {
+ T_FileStream_write(out,"\" +\n",4);
+ write_tabs(out);
+ }
}else{
T_FileStream_write(out,current,bufLen-len);
}
char byteBuffer[100] = { 0 };
uint8_t* byteArray = NULL;
int byteIterator = 0;
-
int32_t srcLen=res->fLength;
-
if(srcLen>0 )
{
byteArray = res->fData;