2
Could you help me with a question? My code is not accentuating the text file, even passing the encoding. (I am reading it in notepad)
Scanner in = new Scanner(System.in);
private String texto;
public void escrever(){
try{
PrintStream ps = new PrintStream("saida.txt","UTF-8");
for(;;){
System.out.print(">> ");
this.setTexto(in.nextLine());
if(texto.equals("::exit")){
System.out.print("Saindo...");
break;
}else{
ps.println(this.getTexto());
}
}
}catch(FileNotFoundException | UnsupportedEncodingException e){
System.out.println(e);
}
}
public String getTexto() {
return texto;
}
public void setTexto(String texto) {
this.texto = texto;
}
I’m sorry for any failure here. I’m still learning how to use the site. Thanks in advance!
Are you entering this information from the operating system console? Which operating system are you using?
– Felipe Marinho
I am entering through the netbeans terminal. And using windows 10.
– Wallace Rocha
What is the text that should be printed and how is it being printed? Are you opening it from the regular notepad? Already checked the encoding of the text editor you are using?
– igventurelli