kopia lustrzana https://github.com/sh123/codec2_talkie
Support for UTF-8 in comments
rodzic
6b119b892d
commit
ce069d92f2
|
@ -11,6 +11,7 @@ import com.radio.codec2talkie.tools.TextTools;
|
|||
import com.radio.codec2talkie.tools.UnitTools;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -143,7 +144,7 @@ public class AprsDataPositionReport implements AprsData {
|
|||
|
||||
byte[] tail = new byte[buffer.remaining()];
|
||||
buffer.get(tail);
|
||||
String strTail = new String(tail);
|
||||
String strTail = new String(tail, StandardCharsets.UTF_8);
|
||||
Pattern latLonPattern = Pattern.compile("^([\\\\/])(\\S{4})(\\S{4})(\\S)(.\\S)?(\\S)?(.*)$", Pattern.DOTALL);
|
||||
Matcher latLonMatcher = latLonPattern.matcher(strTail);
|
||||
if (!latLonMatcher.matches()) {
|
||||
|
@ -215,7 +216,7 @@ public class AprsDataPositionReport implements AprsData {
|
|||
// read latitude/symbol_table/longitude/symbol
|
||||
byte[] tail = new byte[buffer.remaining()];
|
||||
buffer.get(tail);
|
||||
String strTail = new String(tail);
|
||||
String strTail = new String(tail, StandardCharsets.UTF_8);
|
||||
Pattern latLonPattern = Pattern.compile(
|
||||
"^" +
|
||||
"(?:.*)?" + // optional timestamp
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.radio.codec2talkie.tools.TextTools;
|
|||
import com.radio.codec2talkie.tools.UnitTools;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
@ -222,9 +223,9 @@ public class AprsDataPositionReportMicE implements AprsData {
|
|||
if (infoData.length > 11 && infoData[11] == '}') {
|
||||
_position.hasAltitude = true;
|
||||
_position.altitudeMeters = ((infoData[8] - 33) * 91 * 91 + (infoData[9] - 33) * 91 + (infoData[10] - 33)) - 10000;
|
||||
_position.comment = TextTools.stripNulls(new String(Arrays.copyOfRange(infoData, 12, infoData.length)));
|
||||
_position.comment = TextTools.stripNulls(new String(Arrays.copyOfRange(infoData, 12, infoData.length), StandardCharsets.UTF_8));
|
||||
} else {
|
||||
_position.comment = TextTools.stripNulls(new String(Arrays.copyOfRange(infoData, 8, infoData.length)));
|
||||
_position.comment = TextTools.stripNulls(new String(Arrays.copyOfRange(infoData, 8, infoData.length), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
_position.maidenHead = UnitTools.decimalToMaidenhead(_position.latitude, _position.longitude);
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.radio.codec2talkie.protocol.message.TextMessage;
|
|||
import com.radio.codec2talkie.protocol.position.Position;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class AprsDataTextMessage implements AprsData {
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue