-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garbled error message text #16
Comments
First, let's try to fix the garbled error message. Can you post the full error message stack trace? I want to see which JVisa method the error happens in. |
Hello, do you have a good solution to this problem? |
Right now I do not know a solution. I agree the problem happens in the Can you open Command Prompt, run these commands:
then post the output |
I found that 0xBFFF0011 is the bitwise inverse of 0x4000FFEE. Where did you find that text which has Can you edit the byteBufferToString method to be this code, then run your example; protected static String byteBufferToString(ByteBuffer buf) {
java.nio.charset.Charset[] standardCharsets = new java.nio.charset.Charset[]{
java.nio.charset.StandardCharsets.US_ASCII,
java.nio.charset.StandardCharsets.ISO_8859_1,
java.nio.charset.StandardCharsets.UTF_8,
java.nio.charset.StandardCharsets.UTF_16BE,
java.nio.charset.StandardCharsets.UTF_16LE,
java.nio.charset.StandardCharsets.UTF_16
};
for (java.nio.charset.Charset charset : standardCharsets) {
System.out.printf("%10s: \"%s\"\n", charset, new String(buf.array(), charset).trim());
}
return new String(buf.array()).trim();
} |
Information found at this URL. https://github.com/varses/awsch/blob/master/lantz/drivers/legacy/visalib.py I have tried all methods of setting Charset, but to no avail. |
Let's try this next: protected static String byteBufferToString(ByteBuffer buf) {
byte[] bytes = buf.array();
for (int i = 0; i < bytes.length; i++) {
System.out.printf("%3d: %3d == 0x%02X\n", i, bytes[i], bytes[i]);
}
return new String(buf.array()).trim();
} |
Now I changed the GPIB device and got the following error message when running: 0: -50 == 0xCE |
I cannot decode those bytes either
|
package xyz.froud.jvisa.eventhandling;
import java.nio.charset.Charset;
public class ByteExample {
public static void main(String[] args) {
byte[] data = {
-50, // 0xCE
-34, // 0xDE
-73, // 0xB7
-88, // 0xA8
-43, // 0xD5
-46, // 0xD2
-75, // 0xB5
-67, // 0xBD
-69, // 0xBB
-14, // 0xF2
-68, // 0xBC
-45, // 0xD3
-44, // 0xD4
-40, // 0xD8
86, // 0x56
73, // 0x49
83, // 0x53
65, // 0x41
-69, // 0xBB
-14, // 0xF2
86, // 0x56
73, // 0x49
83, // 0x53
65, // 0x41
-75, // 0xB5
-60, // 0xC4
-76, // 0xB4
-6, // 0xFA
-62, // 0xC2
-21, // 0xEB
-65, // 0xBF
-30, // 0xE2
-95, // 0xA1
-93, // 0xA3
32, // 0x20
32, // 0x20
-43, // 0xD5
-30, // 0xE2
-51, // 0xCD
-88, // 0xA8
-77, // 0xB3
-93, // 0xA3
-54, // 0xCA
-57, // 0xC7
-46, // 0xD2
-14, // 0xF2
-50, // 0xCE
-86, // 0xAA
-49, // 0xCF
-75, // 0xB5
-51, // 0xCD
-77, // 0xB3
-55, // 0xC9
-49, // 0xCF
-50, // 0xCE
-76, // 0xB4
-80, // 0xB0
-78, // 0xB2
-41, // 0xD7
-80, // 0xB0
-53, // 0xCB
-7, // 0xF9
-48, // 0xD0
-24, // 0xE8
-75, // 0xB5
-60, // 0xC4
-57, // 0xC7
-3, // 0xFD
-74, // 0xB6
-81, // 0xAF
-77, // 0xB3
-52, // 0xCC
-48, // 0xD0
-14, // 0xF2
-95, // 0xA1
-93 // 0xA3
};
System.out.println(new String(data, Charset.forName("GBK")));
}
} It looks like the encoding is GBK, and by setting GBK encoding to parse the garbled text, I got the content: “无法找到或加载VISA或VISA的代码库。 这通常是因为系统上未安装所需的驱动程序。” Here is the translation: “Unable to find or load VISA or VISA’s code library. This usually happens because the required drivers are not installed on the system.” |
Thank you yuyangyumi! Hi @changhexuefei, does using GBK encoding work on your computer? On my computer, I still get |
in viOpen(): λ����Ϣ�����ϵͳ�в������豸����Դ�� (0x4000FFEE)
The text was updated successfully, but these errors were encountered: