Changeset 315 for tools

Show
Ignore:
Timestamp:
05/01/09 09:54:36 (10 months ago)
Author:
anton
Message:

Response character encoding fixed

Location:
tools/routingservice/branches/wrs-2.0/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • tools/routingservice/branches/wrs-2.0/src/WRS.java

    r314 r315  
    6565import util.Sref; 
    6666 
     67import org.restlet.data.CharacterSet; 
    6768import org.restlet.data.Form; 
    6869import org.restlet.data.MediaType; 
     
    154155                        System.exit(0); 
    155156                } 
     157                 
     158                System.out.println(System.getProperty("file.encoding")); 
    156159 
    157160                log = new Log(this.conf.getLog().getUrl(), this.conf.getLog() 
     
    245248                                        response.setEntity(result, MIMETypes.valueOf( 
    246249                                                        templateType.toUpperCase()).getType()); 
     250                                        //Magical thing you need to do to set a proper encoding 
     251                                        response.getEntity().setCharacterSet(CharacterSet.valueOf("UTF-8"));  
    247252                                } 
    248253                                catch (InvalidVersionException e) 
  • tools/routingservice/branches/wrs-2.0/src/handler/DatabaseHandler.java

    r314 r315  
    2020import geometry.Point; 
    2121 
     22import java.io.UnsupportedEncodingException; 
    2223import java.math.BigDecimal; 
    2324import java.sql.Connection; 
     
    142143                                                        op.setType(request.getService().getOut().get(key) 
    143144                                                                        .getType()); 
    144                                                         op.setValue(result.getString(key)); 
     145                                                        //op.setValue(result.getString(key)); 
     146                                                        op.setValue(new String(result.getBytes(key), "UTF-8")); 
    145147 
    146148                                                        paraMap.put(key, op); 
     
    148150                                                out.add(paraMap); 
    149151                                        } 
     152                                        stmt.close(); 
    150153                                } 
    151154                                catch (SQLException e) 
     155                                { 
     156                                        // TODO Auto-generated catch block 
     157                                        e.printStackTrace(); 
     158                                } 
     159                                catch (UnsupportedEncodingException e) 
    152160                                { 
    153161                                        // TODO Auto-generated catch block