Hi Sergio,
File d = new File(this.getClass().getClassLoader().getResource
("full.rdf").getPath()); // the file is correctly UTF-8 encoded
FileInputStream fis= new FileInputStream(d);
byte[] b = new byte[fis.available()];
fis.read(b);
fis.close ();
String rdf = new String (b);
The default encoding may be ISO8859_1, which could give the wrong
result. For proper checking you should set:
String rdf = new String (b, "UTF-8");
System.out.println(rdf); // Text printed correctly encoded,
also parsing it with a Jena Model
VirtModel virtModel = VirtModel.createDefaultModel
("jdbc:virtuoso://localhost:1111/charset=UTF-8", "dba", "dba");
virtModel.read(new StringReader(rdf), null);
Also note the input data must be set for utf-8 encoding for correct
loading:
<?xml version="1.0" encoding="utf-8"?>
Now if we execute an sparql query: select * where {?s ?p ?o} we see
the
encoding problem: "AVIL?S" instead of "AVILÉS".
<http://example.org/city/ES/ASTURIAS/AVIL%C3%89S> <http://
purl.org/dc/elements/1.1/title> "AVIL?S"
<<<
Best Regards
Hugh Williams
Professional Services
OpenLink Software
Web: http://www.openlinksw.com
Support: http://support.openlinksw.com
Forums: http://boards.openlinksw.com/support
On 3 Sep 2009, at 11:51, Sergio Fernández wrote:
On Mon, 2009-08-31 at 21:05 +0100, Hugh Williams wrote:
How is the data inserted into Virtuoso is this done via the same Jena
application or loaded by some other means ?
Huhg, here you have a piece of code:
File d = new File(this.getClass().getClassLoader
().getResource("full.rdf").getPath()); // the file is correctly
UTF-8 encoded
FileInputStream fis= new FileInputStream(d);
byte[] b = new byte[fis.available()];
fis.read(b);
fis.close ();
String rdf = new String (b);
System.out.println(rdf); // Text printed correctly encoded,
also parsing it with a Jena Model
VirtModel virtModel = VirtModel.createDefaultModel
("jdbc:virtuoso://localhost:1111/charset=UTF-8", "dba", "dba");
virtModel.read(new StringReader(rdf), null);
Now if we execute an sparql query: select * where {?s ?p ?o} we see
the
encoding problem: "AVIL?S" instead of "AVILÉS".
<http://example.org/city/ES/ASTURIAS/AVIL%C3%89S> <http://
purl.org/dc/elements/1.1/title> "AVIL?S"
Do you see anything wrong?
Thanks in advance.
Best,
--
Sergio Fernández - sergio.fernan...@fundacionctic.org
R&D Deparment
CTIC Foundation - www.fundacionctic.org
Phone: +34 984 29 12 12
Fax: +34 984 39 06 12
Edificio Centros Tecnológicos
Parque Científico Tecnológico
33203 Cabueñes - Gijón - Asturias - Spain
----------------------------------------------------------------------
--------
Let Crystal Reports handle the reporting - Free Crystal Reports
2008 30-Day
trial. Simplify your report design, integration and deployment -
and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users