1 package com.jsql.view.swing.util;
2
3 import com.jsql.util.StringUtil;
4 import org.apache.commons.lang3.StringUtils;
5
6 public class UiStringUtil {
7
8 private UiStringUtil() {
9
10 }
11
12 public static String detectUtf8Html(String text) {
13 return UiStringUtil.detectUtf8Html(text, false);
14 }
15
16 public static String detectUtf8HtmlNoWrap(String text) {
17 return UiStringUtil.detectUtf8Html(text, true);
18 }
19
20 public static String detectUtf8Html(String text, boolean nowrap) {
21
22 if (text == null) {
23 return StringUtils.EMPTY;
24 }
25
26
27
28 String result = text;
29 if (StringUtil.containsNonStandardScripts(text)) {
30 result = I18nViewUtil.formatNonLatin(text, nowrap ? "white-space:nowrap;" : StringUtils.EMPTY);
31 }
32 return result;
33 }
34 }