Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più
Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più
Dreame X60 Pro Ultra Complete implementa due bracci estensibili, per spazzola e moccio, che si spingono ben oltre quanto visto sino ad oggi permettendo una pulizia di casa ancor più capillare e precisa
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati
La tecnologia SQD-Mini LED di TCL arriva sul taglio da 65 pollici con la serie C8L: 2040 zone, pannello WHVA 2.0 e un picco che alle rilevazioni delle sonde tocca i 4400 nit nel profilo Filmmaker e un HDR quasi perfetto
MSI Maestro 500 Wireless: ANC e 90 ore di autonomia a 70 euro
MSI Maestro 500 Wireless: ANC e 90 ore di autonomia a 70 euro
Wireless 2.4 GHz, Bluetooth 5.4, cancellazione attiva del rumore, design pieghevole e un'autonomia che mette in imbarazzo prodotti che costano il doppio. Le Maestro 500 non eccellono in nulla, ma offrono tutto. E a questo prezzo è difficile chiedere di più
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


Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più Dreame X60 Pro Ultra Complete: i bracci si esten...
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati TCL 65C8L, la recensione del SQD-Mini LED da 440...
MSI Maestro 500 Wireless: ANC e 90 ore di autonomia a 70 euro MSI Maestro 500 Wireless: ANC e 90 ore di autono...
NL-LC1 è il primo dissipatore a liquido AIO di Noctua: silenzio è la parola d'ordine NL-LC1 è il primo dissipatore a liquido A...
Boox Go 10.3 (Gen II) Lumi: il tablet e-ink con Android 15 e penna, dal prezzo super Boox Go 10.3 (Gen II) Lumi: il tablet e-ink con ...
NASA e Relativity Space uniscono le forz...
watchOS 27 non arriverà su modell...
Apple, definiti i piani per i chip futur...
Ancora tagli nel futuro di XBOX: il caso...
Samsung Galaxy S27, il compatto potrebbe...
Sempre più IA nei videogiochi: con PUBG ...
La NASA avrebbe fermato i lavori sul mod...
Mancano pochi giorni al lancio della mis...
Prime Day in anticipo, giorno 7: tempo d...
Lo smartphone HONOR con batteria da 11.0...
Amazfit Bip 5, Active 3 Premium e Balanc...
Xiaomi potrebbe portare i suoi Pro e Pro...
Crisi delle memorie: CMF annulla il pros...
La PS6 si farà attendere: il lanc...
OnePlus non sente la crisi delle memorie...
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: 00:30.


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