Revision 5492 trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGISWriter.java

View differences:

PostGISWriter.java
1 1
package com.iver.cit.gvsig.fmap.drivers.jdbc.postgis;
2 2

  
3 3
import java.sql.Connection;
4
import java.sql.ResultSet;
4 5
import java.sql.SQLException;
5 6
import java.sql.Statement;
6 7
import java.sql.Types;
......
85 86

  
86 87
	public void preProcess() throws EditionException {
87 88
		numRows = 0;
89
        // ATENTION: We will transform (in PostGIS class; doubleQuote())
90
        // to UTF-8 strings. Then, we tell the PostgreSQL server
91
        // that we will use UTF-8, and it can translate
92
        // to its charset
93
        // Note: we have to translate to UTF-8 because
94
        // the server cannot manage UTF-16
95
        ResultSet rsAux;
96
		try {
97
			rsAux = st.executeQuery("SHOW server_encoding;");
98
	        rsAux.next();
99
	        String serverEncoding = rsAux.getString(1);
100
	        System.out.println("Server encoding = " + serverEncoding);
101
	        // st.execute("SET CLIENT_ENCODING TO 'UNICODE';");
102
	        // Intentamos convertir nuestras cadenas a ese encode.
103
	        PostGIS.toEncode = serverEncoding;
104
		} catch (SQLException e) {
105
			// TODO Auto-generated catch block
106
			e.printStackTrace();
107
		}
88 108

  
89 109
	}
90 110

  

Also available in: Unified diff