File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
component-api/src/main/java/org/talend/sdk/component/api/record Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -52,13 +52,15 @@ public static String sanitizeConnectionName(final String name) {
52
52
53
53
for (int i = 1 ; i < name .length (); i ++) {
54
54
char current = name .charAt (i );
55
- if (!ascii .canEncode (current )) {
55
+ if (ascii .canEncode (current )) {
56
+ sanitizedBuilder .append (Character .isLetterOrDigit (current ) ? current : '_' );
57
+ } else {
56
58
if (Character .isLowerCase (current ) || Character .isUpperCase (current )) {
57
59
sanitizedBuilder .append ('_' );
58
60
} else {
59
61
final byte [] encoded =
60
62
Base64 .getEncoder ().encode (name .substring (i , i + 1 ).getBytes (StandardCharsets .UTF_8 ));
61
- final String enc = new String (encoded );
63
+ final String enc = new String (encoded , StandardCharsets . UTF_8 );
62
64
if (sanitizedBuilder .length () == 0 && Character .isDigit (enc .charAt (0 ))) {
63
65
sanitizedBuilder .append ('_' );
64
66
}
@@ -70,10 +72,6 @@ public static String sanitizeConnectionName(final String name) {
70
72
}
71
73
}
72
74
}
73
- } else if (Character .isLetterOrDigit (current )) {
74
- sanitizedBuilder .append (current );
75
- } else {
76
- sanitizedBuilder .append ('_' );
77
75
}
78
76
79
77
}
You can’t perform that action at this time.
0 commit comments