0

I'm trying to encrypt files in java using random characters. I have created these characters using the private character editor app in windows 10.

However, when I replace letters in a string with these custom characters, the letters are replaced with "?" instead of the desired character.

How can I make it so the letters will be replaced with the desired characters?

Thanks!

EDIT: Here's a screenshot of the character.

enter image description here

String text;
                
    while ((text = br.readLine()) != null) {
        System.out.println(text.replace("a", ""));
    }
                
    br.close();
15
  • @user please check the edit I just posted. What do I need to change? Commented Jul 13, 2020 at 23:22
  • 1
    Hmm, wouldn't that be a font matter really? Commented Jul 13, 2020 at 23:23
  • Would I need to create a font with all of these custom characters and then import the font into eclipse? Commented Jul 13, 2020 at 23:24
  • 1
    @ElliottV4 And you expect the terminal to use your png file when you do System.out.println()? If so, you need to create a custom font. Commented Jul 13, 2020 at 23:29
  • 3
    You're facing an X Y Problem... you're fixated on a solution to a symptom, but you have some other (real) problem that you're ignoring. You need to add code that demonstrates how you use this character to encrypt your data. Are you using some metrics from the character? Are you interpolating the actual character? Provide some details, or you're going to be stuck in this dead end for a while. Commented Jul 13, 2020 at 23:30

1 Answer 1

1

The first problem you have is that you are trying to write this text to the console with System.out.print. Console output is fairly limited for a number of reasons, most of all because the console UI is not drawn by your program, so you have limited control over it. You need to create a graphical user interface if you want to display these characters.

The simplest GUI there is, is showing a message dialog:

String text = "";
JOptionPane.showMessageDialog(null, text);

The second problem is, that the GUI has to use the custom font you create with the private character editor app. That's how this "character editor" works: it creates a custom font, which is then used by other Windows applications. After some digging, I've found that the editor saves the custom font as a TTE file which is a file format I've never heard of before. There is a standard Java API to load custom fonts but I'm not sure if it will support the files created by the "private character editor".

If you're serious about creating custom fonts, you may want to switch to using more standard font editing software such as FontForge.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I'll look into this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.