Hello?
I've been testing BaseX for data backup in a Linux environment for a few months.
(Some of the contents are in Japanese.)
While using it a while ago, suddenly "Invalid byte 1 of 1-byte UTF-8 sequence." An error has occurred.
The content of the file used was fine and was the same as before.
I opened this file in VI editor and simply saved and exited.
And when I ran the program again, it worked normally.
- This file is a compressed xml file in gz format.
- The program reads this file, takes the necessary parts, and saves them by passing them to BaseX through the PUT Method.
- In this part, "Invalid byte 1 of 1-byte UTF-8 sequence." has occurred.
This has been happening for a few hours and I haven't taken any action, but now it's working fine.
Is there a part that uses BaseX and can explain why this is happening? Or is it a program problem?
Can this problem occur using BaseX? Or is it a problem with the program or the environment?
I think it's an encoding problem, but I don't know the exact cause.
- The program is made in Java.
- Some of the contents of reading and transmitting data are as follows.
URL url = new URL(urlTemp);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("PUT");
conn.setRequestProperty("Content-Type", "application/xml");
OutputStream out = conn.getOutputStream();
InputStream in = null;
in = new GZIPInputStream(new FileInputStream(filePath));
int len = 0;
byte[] readBuffer = new byte[1024];
while ((len = in.read(readBuffer)) > 0) {
out.write(readBuffer, 0, len);
}