There is a string variable
public static String MSG; Its task is to receive a data packet from the X-Bee network and display applications and write to text.
MSG = new String(xBeePacket.toString()); helloWorld2.appendText("IN: "+MSG+"\n"); //запись в текстовое поле helloWorld2 try (FileWriter writer = new FileWriter(filename(), true)) { writer.append(MSG); writer.append("\r\n"); writer.flush(); } catch (IOException ex) { System.out.println(ex.getMessage()); } Everything comes to the text field clearly. For example, there are 2 packages: 7E0023910013A200414F926F68FEE8E80011C1050101FCA0550153158E07134650019047505306 7E0023910013A200415B69C75C5AE8E80011C1050101FCA055015158E0715515515515515515515005A1055A5155A5155A07555A5308A105A105A105A104AF426F68FEE8E80011C1050101FCA0550153158E07134650019047505306
But in the file it looks different: 7E0023910013A200414F926F68FEE8E80011C1050101FCA0550153158E07134650019047505306 US FP GPS
You may notice that at the end there are GPS symbols, however, in the package, the codes for these symbols are not recent, it turns out that he also cut part of the package. The strangest thing is that these packages are of the same type and almost identical, but why in one of the packages the program decided to translate characters, and the probability of such a bebird is unpredictable, it may not be at all, and almost all the lines may be filled in this way, while everything in the text field correctly displayed.
MSG = new String(xBeePacket.toString().getBytes(), "UTF-8");- first attemptString MSG = new String(Controller.MSG.getBytes(),"UTF-8");- second try - Klaus