@@ -73,19 +73,28 @@ public static ConfiguracoesNfe criarConfiguracoes(EstadosEnum estado, AmbienteEn
7373 ObjetoUtil .verifica (certificado ).orElseThrow (() -> new IllegalArgumentException ("Certificado não pode ser Nulo." )));
7474 configuracoesNfe .setPastaSchemas (pastaSchemas );
7575
76- try {
77- //Setando Encoding.
78- System .setProperty ("file.encoding" , "UTF-8" );
79- Field charset = Charset .class .getDeclaredField ("defaultCharset" );
80- charset .setAccessible (true );
81- charset .set (null , null );
82- } catch (NoSuchFieldException | IllegalAccessException e ) {
83- throw new CertificadoException ("Erro ao setar Encoding." );
76+ /**
77+ * Para as versões Java até 11, Eu ainda ceto o Encoding por que é permitido.
78+ * Para quem trabalha com Java 12+, Aconselhasse setar o Encoding :
79+ * -Dfile.encoding="UTF-8"
80+ * -Dsun.jnu.encoding="UTF-8"
81+ *
82+ */
83+ if (Integer .parseInt (System .getProperty ("java.class.version" ).substring (0 ,2 )) < 56 ){
84+ try {
85+ //Setando Encoding.
86+ System .setProperty ("file.encoding" , "UTF-8" );
87+ Field charset = Charset .class .getDeclaredField ("defaultCharset" );
88+ charset .setAccessible (true );
89+ charset .set (null , null );
90+ } catch (NoSuchFieldException | IllegalAccessException e ) {
91+ throw new CertificadoException ("Erro ao setar Encoding." );
92+ }
8493 }
8594
8695 if (Logger .getLogger ("" ).isLoggable (Level .SEVERE )) {
8796 System .err .println ("####################################################################" );
88- System .err .println (" Api Java Nfe - Versão 4.00.18E -SNAPSHOT - 05 /04/2022" );
97+ System .err .println (" Api Java Nfe - Versão 4.00.18F -SNAPSHOT - 21 /04/2022" );
8998 if (Logger .getLogger ("" ).isLoggable (Level .WARNING )) {
9099 System .
err .
println (
" Samuel Olivera - [email protected] " );
91100 }
0 commit comments