summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <599206+bilal-alsharifi@users.noreply.github.com>2020-08-05 16:44:46 -0400
committerGitHub <noreply@github.com>2020-08-05 16:44:46 -0400
commit621dafbf92ae9dbcec8a82ea7820eecc662621d7 (patch)
tree7cbf7f7eed28df23b35a41b78a74c15d853515c1
parent88fc8bf74837d5adcfc08b3ebafb550e02431974 (diff)
parent7353c797a05752bed56c830da4208c06f31d90cb (diff)
downloadsdl_android-621dafbf92ae9dbcec8a82ea7820eecc662621d7.tar.gz
Merge pull request #1427 from smartdevicelink/feature/0202_SupportedCharacterSets
Feature/0202 supported character sets
-rw-r--r--android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json2
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java76
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java85
6 files changed, 118 insertions, 63 deletions
diff --git a/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json b/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
index e5c0c181f..3c5271d9c 100644
--- a/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
+++ b/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
@@ -163,7 +163,7 @@
},
{
"width":1980,
- "characterSet":"CID2SET",
+ "characterSet":"UTF_8",
"rows":960,
"name":"scrollableMessageBody"
},
diff --git a/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json b/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
index ec9e62f54..5ff32ac6a 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
@@ -73,7 +73,7 @@
},
{
"width":1980,
- "characterSet":"CID2SET",
+ "characterSet":"UTF_8",
"rows":960,
"name":"scrollableMessageBody"
},
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
index fa5e36f3f..78a1325f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
@@ -26,11 +26,20 @@ public class CharacterSetTests extends TestCase {
CharacterSet enumCid1Set = CharacterSet.valueForString(example);
example = "CID2SET";
CharacterSet enumCid2Set = CharacterSet.valueForString(example);
-
+ example = "ASCII";
+ CharacterSet enumAsciiSet = CharacterSet.valueForString(example);
+ example = "ISO_8859_1";
+ CharacterSet enumIsoSet = CharacterSet.valueForString(example);
+ example = "UTF_8";
+ CharacterSet enumUtfSet = CharacterSet.valueForString(example);
+
assertNotNull("TYPE2SET returned null", enumType2Set);
assertNotNull("TYPE5SET returned null", enumType5Set);
assertNotNull("CID1SET returned null", enumCid1Set);
assertNotNull("CID2SET returned null", enumCid2Set);
+ assertNotNull("ASCII returned null", enumAsciiSet);
+ assertNotNull("ISO_8859_1 returned null", enumIsoSet);
+ assertNotNull("UTF_8 returned null", enumUtfSet);
}
/**
@@ -72,6 +81,9 @@ public class CharacterSetTests extends TestCase {
enumTestList.add(CharacterSet.TYPE5SET);
enumTestList.add(CharacterSet.CID1SET);
enumTestList.add(CharacterSet.CID2SET);
+ enumTestList.add(CharacterSet.ASCII);
+ enumTestList.add(CharacterSet.ISO_8859_1);
+ enumTestList.add(CharacterSet.UTF_8);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
index 9fd8c59f7..2bac81e42 100644
--- a/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
+++ b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
@@ -107,7 +107,7 @@ public class ManagerUtility {
public static List<TextField> getAllTextFields() {
List<TextField> allTextFields = new ArrayList<>();
for (TextFieldName name : TextFieldName.values()) {
- allTextFields.add(new TextField(name, CharacterSet.CID1SET, 500, 8));
+ allTextFields.add(new TextField(name, CharacterSet.UTF_8, 500, 8));
}
return allTextFields;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
index 514b5ba0f..497bd66ee 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -58,7 +58,7 @@ import java.util.Hashtable;
* <tr>
* <td>characterSet</td>
* <td>CharacterSet</td>
- * <td>The character set that is supported in this field. </td>
+ * <td>The set of characters that are supported by this text field. All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8. All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
@@ -114,7 +114,9 @@ public class TextField extends RPCStruct {
/**
* Constructs a newly allocated TextField object
* @param name Enumeration identifying the field.
- * @param characterSet The character set that is supported in this field.
+ * @param characterSet The set of characters that are supported by this text field.
+ * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
+ * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
* @param width The number of characters in one row of this field.
* @param rows The number of rows for this text field.
*/
@@ -141,14 +143,18 @@ public class TextField extends RPCStruct {
}
/**
* Get the character set that is supported in this field.
- * @return the character set
+ * @return The set of characters that are supported by this text field.
+ * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
+ * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
*/
public CharacterSet getCharacterSet() {
return (CharacterSet) getObject(CharacterSet.class, KEY_CHARACTER_SET);
}
/**
* Set the character set that is supported in this field.
- * @param characterSet - the character set
+ * @param characterSet - The set of characters that are supported by this text field.
+ * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
+ * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
*/
public void setCharacterSet(@NonNull CharacterSet characterSet ) {
setValue(KEY_CHARACTER_SET, characterSet);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
index a1fb294e2..a2170c70a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
@@ -29,27 +29,64 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.proxy.rpc.enums;
-/**
- * Character sets supported by SDL.
- * @since SmartDeviceLink 1.0
- */
-public enum CharacterSet {
- TYPE2SET,
- TYPE5SET,
- CID1SET,
- CID2SET;
-
- /**
- * Convert String to CharacterSet
- * @param value String
- * @return CharacterSet
- */
- public static CharacterSet valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+/**
+ * Character sets supported by SDL.
+ * @since SmartDeviceLink 1.0
+ */
+public enum CharacterSet {
+ /**
+ * @deprecated in SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ TYPE2SET,
+ /**
+ * @deprecated in SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ TYPE5SET,
+ /**
+ * @deprecated in SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ CID1SET,
+ /**
+ * @deprecated in SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ CID2SET,
+ /**
+ * ASCII as defined in https://en.wikipedia.org/wiki/ASCII as defined in codes 0-127.
+ * Non-printable characters such as tabs and back spaces are ignored.
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ ASCII,
+ /**
+ * Latin-1, as defined in https://en.wikipedia.org/wiki/ISO/IEC_8859-1
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ ISO_8859_1,
+ /**
+ * The UTF-8 character set that uses variable bytes per code point.
+ * See https://en.wikipedia.org/wiki/UTF-8 for more details.
+ * This is the preferred character set.
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ UTF_8;
+
+ /**
+ * Convert String to CharacterSet
+ * @param value String
+ * @return CharacterSet
+ */
+ public static CharacterSet valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}