| Autor |
Mensagem |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:20:54
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
Estou importando um arquivo em txt, estão aparecendo alguns caracteres estranhos, tem como eliminar ?
Exemplo : Ôªø123.456
Desde já agradeço !
This message was edited 1 time. Last update was at 14/06/2011 07:53:28
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:29:39
|
mateuscs
JavaTeenager
![[Avatar]](/images/avatar/13818d8946058c49245d1dbb40c20f90.jpg)
Membro desde: 10/05/2011 13:13:14
Mensagens: 179
Offline
|
Metaleiro
tem como você postar um trecho de seu txt?
Creio que seja definições de arquivo texto para codificação de idiomas.
por exemplo: \u00E7 para Ç
\u00E3 para ã
|
Mateus C. Santos
Estudante de Ciência da Computação
Programador JAVA
Técnico em Telecomunicações
Cadista
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:35:54
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
Ele está assim :
123.456.789-101234567891011123SP
postei um trecho, na hora que ele importa, aparecem aqueles caracteres, meu arquivo está em UTF8
Obrigado !
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:36:13
|
pedruhenrik
GUJ Master
![[Avatar]](/images/avatar/fe35cdc3b5e88ce55f6659889fe2937f.jpg)
Membro desde: 08/05/2008 11:48:36
Mensagens: 1043
Localização: São Paulo - SP
Offline
|
http://download.oracle.com/javase/6/docs/api/java/text/Normalizer.html
procure por normalizer, talvez ajude.
att,
|
...tem um plano A e tem um plano B...
http://twitter.com/pedruhenrik |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:41:09
|
nel
JWizard
![[Avatar]](/images/avatar/1a9537e58dcb1a9913e1fc10c65c7994.jpg)
Membro desde: 01/10/2009 13:51:10
Mensagens: 2364
Offline
|
Oi!
Isso aqui resolve o seu problema.
Basicamente, é utilizar o método replaceAll com regex da seguinte forma:
Veja o link que lhe passei que exemplifica bem isso.
Abraços!!!
|
"Se houver a terceira guerra mundial eu não sei como será mas a quarta será com paus e pedras" Albert Einsten. |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 10:52:28
|
Vingdel
JavaEvangelist
![[Avatar]](/images/avatar/8e3a470dfb7d426c470e8e9bdf44df13.jpg)
Membro desde: 19/11/2006 22:09:57
Mensagens: 358
Localização: Cabo Frio - RJ
Offline
|
Se teu arquivo não tem caractéres especiais, salve-o como ANSI.
Isso vai resolver.
|
Caso tua dúvida esteja sanada edite tua primeira postagem no tópico e adicione [RESOLVIDO] ao assunto.
Poste teu código entre as tags [code] ... [/code].



 |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 11:37:33
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
nel wrote:Oi!
Isso aqui resolve o seu problema.
Basicamente, é utilizar o método replaceAll com regex da seguinte forma:
Veja o link que lhe passei que exemplifica bem isso.
Abraços!!!
Funciona bem, mas ele acaba ignorando os espaços em branco do meu arquivo, eu preciso deles, obrigado
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 11:38:01
|
mateuscs
JavaTeenager
![[Avatar]](/images/avatar/13818d8946058c49245d1dbb40c20f90.jpg)
Membro desde: 10/05/2011 13:13:14
Mensagens: 179
Offline
|
Metaleiro
Como nosso amigo Vingdel mencinou, se seu arquivo não possuir char especial, salve como ansi, e faça o teste.
|
Mateus C. Santos
Estudante de Ciência da Computação
Programador JAVA
Técnico em Telecomunicações
Cadista
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 12:36:26
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
mateuscs wrote:Metaleiro
Como nosso amigo Vingdel mencinou, se seu arquivo não possuir char especial, salve como ansi, e faça o teste.
Meu arquivo obrigatoriamente tem que ser em ASCII, agora o único problema são os espaços em branco no arquivo.
Exemplo :
18.257.555-4 SSP 133442
Ele me coloca algo do tipo 18.257.555-4/254
Se alguém puder me ajudar, agradeço.
Obrigado a todos
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 13:03:42
|
nel
JWizard
![[Avatar]](/images/avatar/1a9537e58dcb1a9913e1fc10c65c7994.jpg)
Membro desde: 01/10/2009 13:51:10
Mensagens: 2364
Offline
|
Metaleiro wrote:
mateuscs wrote:Metaleiro
Como nosso amigo Vingdel mencinou, se seu arquivo não possuir char especial, salve como ansi, e faça o teste.
Meu arquivo obrigatoriamente tem que ser em ASCII, agora o único problema são os espaços em branco no arquivo.
Exemplo :
18.257.555-4 SSP 133442
Ele me coloca algo do tipo 18.257.555-4/254
Se alguém puder me ajudar, agradeço.
Obrigado a todos
Oi! O que seria "meu problema são os espaços em branco" ?
E o que aquele regex que lhe passei faz que não atende a sua necessidade?
E por fim, esse "18.257.555-4/254" seria a saida para uma String com contéudo igual a "18.257.555-4 SSP 133442" ?
Abraços.
|
"Se houver a terceira guerra mundial eu não sei como será mas a quarta será com paus e pedras" Albert Einsten. |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 13:23:55
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
nel wrote:
Metaleiro wrote:
mateuscs wrote:Metaleiro
Como nosso amigo Vingdel mencinou, se seu arquivo não possuir char especial, salve como ansi, e faça o teste.
Meu arquivo obrigatoriamente tem que ser em ASCII, agora o único problema são os espaços em branco no arquivo.
Exemplo :
18.257.555-4 SSP 133442
Ele me coloca algo do tipo 18.257.555-4/254
Se alguém puder me ajudar, agradeço.
Obrigado a todos
Oi! O que seria "meu problema são os espaços em branco" ?
E o que aquele regex que lhe passei faz que não atende a sua necessidade?
E por fim, esse "18.257.555-4/254" seria a saida para uma String com contéudo igual a "18.257.555-4 SSP 133442" ?
Abraços.
Não, quando pego minha String ele está substituindo todos os espaços em branco por \240\240\240, ele substitui todos eles por isso, e minha aplicação dá erro, muito obrigado !
É o único problema que ainda sobra os espaços em branco, quando leio a o arquivo ele substitui por isso.
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 13:26:49
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
POST DUPLICADO
This message was edited 1 time. Last update was at 13/06/2011 13:36:23
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 13:43:50
|
Vingdel
JavaEvangelist
![[Avatar]](/images/avatar/8e3a470dfb7d426c470e8e9bdf44df13.jpg)
Membro desde: 19/11/2006 22:09:57
Mensagens: 358
Localização: Cabo Frio - RJ
Offline
|
Você já tentou fazer assim?
|
Caso tua dúvida esteja sanada edite tua primeira postagem no tópico e adicione [RESOLVIDO] ao assunto.
Poste teu código entre as tags [code] ... [/code].



 |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 14:06:42
|
Metaleiro
Virtual Machine Man
![[Avatar]](/images/avatar/c2155acc6d5bcda7debfb19c3abef4af.jpg)
Membro desde: 06/07/2006 10:55:54
Mensagens: 671
Localização: São Bernardo do Campo - SP
Offline
|
Vingdel wrote:Você já tentou fazer assim?
Ocorreu o seguinte :
The constructor BufferedReader(InputStreamReader) is undefined
encontrei isso na net :
BufferedReader
Obrigado
|
"Why, Mr. Anderson? Why do you do it? Why get up? Why keep fighting? Do you believe you're fighting for something? For more than your survival? Can you tell me what it is? Do you even know? Is it freedom? Or truth? Perhaps peace? Yes? No? Could it be for love? Illusions, Mr. Anderson. Vagaries of perception. The temporary constructs of a feeble human intellect trying desperately to justify an existence that is without meaning or purpose. And all of them as artificial as the Matrix itself, although only a human mind could invent something as insipid as love. You must be able to see it, Mr. Anderson. You must know it by now. You can?t win. It?s pointless to keep fighting. Why, Mr. Anderson? Why? Why do you persist?"
Neo :
-Because is my choice
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/06/2011 14:20:55
|
Vingdel
JavaEvangelist
![[Avatar]](/images/avatar/8e3a470dfb7d426c470e8e9bdf44df13.jpg)
Membro desde: 19/11/2006 22:09:57
Mensagens: 358
Localização: Cabo Frio - RJ
Offline
|
Você tem que importar o pacote.
[]'s
|
Caso tua dúvida esteja sanada edite tua primeira postagem no tópico e adicione [RESOLVIDO] ao assunto.
Poste teu código entre as tags [code] ... [/code].



 |
|
|
 |
|
|