mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add PunyCode
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package cn.hutool.core.codec;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PunyCodeTest {
|
||||
|
||||
@Test
|
||||
public void encodeDecodeTest(){
|
||||
String text = "Hutool编码器";
|
||||
String strPunyCode = PunyCode.encode(text);
|
||||
Assert.assertEquals("Hutool-ux9js33tgln", strPunyCode);
|
||||
String decode = PunyCode.decode("Hutool-ux9js33tgln");
|
||||
Assert.assertEquals(text, decode);
|
||||
decode = PunyCode.decode("xn--Hutool-ux9js33tgln");
|
||||
Assert.assertEquals(text, decode);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user