return ((field_2_unicode_flag & 0xFF) == 1);
}
- /**
- * check the parameter has multibyte character
- *
- * @param value string to check
- * @return boolean result
- * true:string has at least one multibyte character
- */
- private static boolean hasMultibyte(String value){
- if( value == null )return false;
- for(int i = 0 ; i < value.length() ; i++ ){
- char c = value.charAt(i);
- if(c > 0xFF )return true;
- }
- return false;
- }
/**
* set the length of the footer string
{
field_3_footer = footer;
field_2_unicode_flag =
- (byte) (hasMultibyte(field_3_footer) ? 1 : 0);
+ (byte) (StringUtil.hasMultibyte(field_3_footer) ? 1 : 0);
}
/**
return ((field_2_unicode_flag & 0xFF) == 1);
}
- /**
- * check the parameter has multibyte character
- *
- * @param value string to check
- * @return boolean result
- * true:string has at least one multibyte character
- */
- private static boolean hasMultibyte(String value){
- if( value == null )return false;
- for(int i = 0 ; i < value.length() ; i++ ){
- char c = value.charAt(i);
- if(c > 0xFF )return true;
- }
- return false;
- }
-
/**
* set the length of the header string
*
{
field_3_header = header;
field_2_unicode_flag =
- (byte) (hasMultibyte(field_3_header) ? 1 : 0);
+ (byte) (StringUtil.hasMultibyte(field_3_header) ? 1 : 0);
}
/**
public static String getPreferredEncoding() {
return ENCODING;
}
+
+ /**
+ * check the parameter has multibyte character
+ *
+ * @param value string to check
+ * @return boolean result
+ * true:string has at least one multibyte character
+ */
+ public static boolean hasMultibyte(String value){
+ if( value == null )return false;
+ for(int i = 0 ; i < value.length() ; i++ ){
+ char c = value.charAt(i);
+ if(c > 0xFF )return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param format
+ * @return true if format is Unicode.
+ */
+ public static boolean isUnicodeFormat(final String format) {
+ try {
+ return !format.equals(new String(format.getBytes("ISO-8859-1"), "ISO-8859-1"));
+ } catch (UnsupportedEncodingException e) {
+ return true;
+ }
+ }
}