Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa
Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa
Marvel's Wolverine porta Logan in un'avventura inedita, violenta e fortemente narrativa, costruita attorno alla sua natura di combattente e al difficile rapporto con il proprio passato. Insomniac Games punta su combattimenti spettacolari, progressione e personalizzazione, inserendo l'azione in un mondo segnato dalla persecuzione dei mutanti. Un viaggio intenso, che alterna mattanza, esplorazione e momenti sorprendentemente emotivi.
DJI Romo 2: tante novità lo rendono un robot completo
DJI Romo 2: tante novità lo rendono un robot completo
Romo 2 è la seconda generazione di robot lavapavimenti di DJI, un modello che si caratterizza per la precisione nel sistema di navigazione e per il funzionamento particolarmente silenzioso. Con le modifiche introdotte in questa seconda versione, e un posizionamento di prezzo più allineato alla concorrenza, rappresenta una valida alternativa sul mercato delle soluzioni di pulizia domestica
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED
Il primo Sony con retroilluminazione True RGB alla prova del banco di misura e dei contenuti: luminanza enorme, colori accurati in HDR e un antiriflesso molto efficace. I limiti sono due sole HDMI 2.1 e il blooming fuori asse
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 20-04-2010, 14:16   #1
ndakota
Senior Member
 
L'Avatar di ndakota
 
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
[Java] Convertire una stringa da un charset ad un altro

Salve ragazzi. Come da titolo avrei bisogno di convertire una stringa dal formato us-ascii ad uno ascii esteso qualsiasi. In parole povere la mia stringa non prende le accentate(è me lo ritrovo come qualcosa tipo E=09). E' possibile, passando ad un altro charset(per esempio iso-8859-1), aggiustare questa stringa? Grazie
ndakota è offline   Rispondi citando il messaggio o parte di esso
Old 20-04-2010, 17:12   #2
DanieleC88
Senior Member
 
L'Avatar di DanieleC88
 
Iscritto dal: Jun 2002
Città: Dublin
Messaggi: 5989
Puoi specificare un po' meglio dove e come ti si presenta il problema?
Non vorrei che la mia memoria mi ingannasse, ma mi sembrava che Java gestisse nativamente le stringhe in Unicode.
__________________

C'ho certi cazzi Mafa' che manco tu che sei pratica li hai visti mai!
DanieleC88 è offline   Rispondi citando il messaggio o parte di esso
Old 20-04-2010, 18:06   #3
banryu79
Senior Member
 
L'Avatar di banryu79
 
Iscritto dal: Oct 2007
Città: Padova
Messaggi: 4131
Quote:
Originariamente inviato da Estratto dai Javadoc di java.lang.String
...
A String represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character class for more information). Index values refer to char code units, so a supplementary character uses two positions in a String.
...
+
Quote:
Originariamente inviato da Estratto dai Javadoc di java.nio.charset.Charset
...
Every instance of the Java virtual machine has a default charset, which may or may not be one of the standard charsets. The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system.
...
Gli standard charset a cui si riferisce sarebbero questi:
Codice:
Standard charsets

Every implementation of the Java platform is required to support the following standard charsets. 
Consult the release documentation for your implementation to see if any other charsets are supported. 
The behavior of such optional charsets may differ between implementations.

    US-ASCII 	Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
    ISO-8859-1   	ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
    UTF-8 	Eight-bit UCS Transformation Format
    UTF-16BE 	Sixteen-bit UCS Transformation Format, big-endian byte order
    UTF-16LE 	Sixteen-bit UCS Transformation Format, little-endian byte order
    UTF-16 	Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark
Non ho capito la tua situazione comunque dovresti far presto a fare una prova: partendo dalla tua String e sfruttando il metodo getBytes(Charset) puoi ottenerne l'array di bytes codificati secondo il Charset che desideri, quindi passi questo array come argomento al costruttore di una nuova String e la stampi per vedere cosa sputa: metodo scientifico
__________________

As long as you are basically literate in programming, you should be able to express any logical relationship you understand.
If you don’t understand a logical relationship, you can use the attempt to program it as a means to learn about it.
(Chris Crawford)
banryu79 è offline   Rispondi citando il messaggio o parte di esso
Old 20-04-2010, 21:34   #4
ndakota
Senior Member
 
L'Avatar di ndakota
 
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
Quote:
Originariamente inviato da DanieleC88 Guarda i messaggi
Puoi specificare un po' meglio dove e come ti si presenta il problema?
Non vorrei che la mia memoria mi ingannasse, ma mi sembrava che Java gestisse nativamente le stringhe in Unicode.
Praticamente ricevo il formato di una mail in plain text. E dagli attributi leggo che è in charset "us-ascii".

Quote:
Originariamente inviato da banryu79 Guarda i messaggi
+


Gli standard charset a cui si riferisce sarebbero questi:
Codice:
Standard charsets

Every implementation of the Java platform is required to support the following standard charsets. 
Consult the release documentation for your implementation to see if any other charsets are supported. 
The behavior of such optional charsets may differ between implementations.

    US-ASCII 	Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
    ISO-8859-1   	ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
    UTF-8 	Eight-bit UCS Transformation Format
    UTF-16BE 	Sixteen-bit UCS Transformation Format, big-endian byte order
    UTF-16LE 	Sixteen-bit UCS Transformation Format, little-endian byte order
    UTF-16 	Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark
Non ho capito la tua situazione comunque dovresti far presto a fare una prova: partendo dalla tua String e sfruttando il metodo getBytes(Charset) puoi ottenerne l'array di bytes codificati secondo il Charset che desideri, quindi passi questo array come argomento al costruttore di una nuova String e la stampi per vedere cosa sputa: metodo scientifico
Ho già provato, ma mi stampa sempre la stringa di partenza, anche se il charset cambia. Provato stampando i byte.
ndakota è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa Marvel's Wolverine, la recensione: Logan torna p...
DJI Romo 2: tante novità lo rendono un robot completo DJI Romo 2: tante novità lo rendono un ro...
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED Sony Bravia 9 II: il True RGB alla prova, dove l...
Geely EX5, un mese al volante: il SUV elettrico cinese che ci ha sorpreso (quasi) senza riserve Geely EX5, un mese al volante: il SUV elettrico ...
Mova Z70 Ultra Roller Complete: motore potente, rullo di lavaggio e l'IA a guidare Mova Z70 Ultra Roller Complete: motore potente, ...
NVIDIA non ci sta: "Non lasceremo che l'...
Gli Stati Uniti hanno armi in orbita: ar...
Robot aspirapolvere in offerta su Amazon...
ChatGPT inventa testimoni falsi e un avv...
Find X10 Pro Max di OPPO arriverà...
L'IA scriverà codice migliore del suo st...
Valve apre le prenotazioni di Steam Fram...
ECOVACS T50 OMNI Gen3 a 379€: il riferim...
Netflix e Sega insieme: arrivano i film ...
Veeam ottiene la certificazione da parte...
XIAOMI Redmi Buds 8 a 37,94€: auricolari...
Il fotovoltaico scende sott'acqua: nuove...
Microsoft chiede supervisione umana nell...
MicroSD Samsung T9 da 256GB a 65,88€: sc...
Una RTX 3090 e nessuna riga di codice: Q...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 12:24.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v