java - How to write a data into database using outputstream UTF-8 -
system.out.println("record:::" + recordxml); url url = new url(constants + tablename + "/update?commit=true"); conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod("post"); conn.setrequestproperty("content-type", "application/xml"); outputstream os = conn.getoutputstream(); system.out.println("insertorupdate"); os.write(recordxml.getbytes()); os.flush();
here put utf-8 chracter support
you can use outputstreamwriter.
outputstream os = conn.getoutputstream(); outputstreamwriter ow = new outputstreamwriter(os, "utf-8"); ow.write(recordxml); // note: don't use getbytes() here ow.flush(); ow.close();
Comments
Post a Comment