I want to check file name length
When i check the length of file name I got from mac is different from the length of the name I typed in IDE(Intellij).
So, I took the bytes of the string and printed it to the console, but it was different.
The case I want is the length as if i typed in IDE.
Is this possible?
How can i change the java bytes of string from macString to IDEString
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) {
String fileNameFromMac = "스크린샷.png";
String typedInIDE = "스크린샷.png";
System.out.println("File Name From Mac Length : " + fileNameFromMac.length());
System.out.println("typedInIDE : " + typedInIDE.length());
byte[] fileNameFromMacBytes = fileNameFromMac.getBytes(StandardCharsets.UTF_8);
byte[] typedInIDEBytes = typedInIDE.getBytes(StandardCharsets.UTF_8);
for(byte b : fileNameFromMacBytes) {
System.out.print(b);
}
System.out.println();
for(byte b : typedInIDEBytes) {
System.out.print(b);
}
}
}
