forked from Apple-2-Tools/jace
NOTHING
This commit is contained in:
parent
46b6c20458
commit
d87210849f
51
pom.xml
51
pom.xml
|
@ -77,6 +77,7 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -101,4 +102,54 @@
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<!--<url>http://maven.aliyun.com/nexus/content/groups/public/</url>-->
|
||||||
|
<url>https://maven.aliyun.com/repository/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
<id>ias-snapshots</id>
|
||||||
|
<name>Infinite Automation Snapshot Repository</name>
|
||||||
|
<url>https://maven.mangoautomation.net/repository/ias-snapshot/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
<id>ias-releases</id>
|
||||||
|
<name>Infinite Automation Release Repository</name>
|
||||||
|
<url>https://maven.mangoautomation.net/repository/ias-release/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<!--<url>http://maven.aliyun.com/nexus/content/groups/public/</url>-->
|
||||||
|
<url>https://maven.aliyun.com/repository/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -21,6 +21,9 @@ package jace.core;
|
||||||
import jace.config.ConfigurableField;
|
import jace.config.ConfigurableField;
|
||||||
import jace.config.DynamicSelection;
|
import jace.config.DynamicSelection;
|
||||||
import jace.config.Reconfigurable;
|
import jace.config.Reconfigurable;
|
||||||
|
import jace.library.StringUtils;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
30
src/main/java/jace/library/StringUtils.java
Normal file
30
src/main/java/jace/library/StringUtils.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package jace.library;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
public class StringUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get XML String of utf-8
|
||||||
|
*
|
||||||
|
* @return XML-Formed string
|
||||||
|
*/
|
||||||
|
public static String getUTF8XMLString(String xml) {
|
||||||
|
// A StringBuffer Object
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append(xml);
|
||||||
|
String xmString = "";
|
||||||
|
String xmlUTF8 = "";
|
||||||
|
try {
|
||||||
|
xmString = new String(sb.toString().getBytes("UTF-8"));
|
||||||
|
xmlUTF8 = URLEncoder.encode(xmString, "UTF-8");
|
||||||
|
System.out.println("utf-8 编码:" + xmlUTF8);
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// return to String Formed
|
||||||
|
return xmlUTF8;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user