今天处理bug,接口输入特殊字符(零宽空白),一种前端js控制替换特殊字符;一种java后端控制
package com.shallowan.spring.boot.blog;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtilTools {
//替换特殊字符
private static String zerolize(String s) {
if (s.length() < 4) {
s = "000".substring(0, 4 - s.length()) + s;
}
return s;
}
public static void main(String[] args) throws IOException {
int[] input = new int[] { 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xad, 0x483, 0x484, 0x485, 0x486, 0x487, 0x488, 0x489,
0x559, 0x55a, 0x58a, 0x591, 0x592, 0x593, 0x594, 0x595, 0x596, 0x597, 0x598, 0x599, 0x59a,