Kaydet (Commit) 8d10b737 authored tarafından rbuj's avatar rbuj Kaydeden (comit) David Tardon

javaunohelper: enhancements in decodeUTF8

Change-Id: I452dbd54251eea683d307c346dc4949a42eedc30
Reviewed-on: https://gerrit.libreoffice.org/10862Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 608f330e
......@@ -18,8 +18,8 @@
package com.sun.star.lib.uno.helper;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.ArrayList;
/**
* Object representation and parsing of Uno Urls,
......@@ -208,8 +208,8 @@ public class UnoUrl {
try {
if (s.contains("%")) {
ArrayList<Integer> v = new ArrayList<Integer>();
int length = s.length();
ByteBuffer bb = ByteBuffer.allocate(length);
for (int i = 0; i < length; i++) {
int ch = s.charAt(i);
......@@ -228,16 +228,11 @@ public class UnoUrl {
i+=2;
}
v.add(new Integer(ch));
}
int size = v.size();
byte[] bytes = new byte[size];
for (int i = 0; i < size; i++) {
Integer anInt = v.get(i);
bytes[i] = (byte) (anInt.intValue() & 0xFF);
bb.put((byte) (ch & 0xFF));
}
byte[] bytes = new byte[bb.position()];
System.arraycopy(bb.array(), 0, bytes, 0, bytes.length);
return new String(bytes, "UTF-8");
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment