From: Anjo K. <kr...@lo...> - 2006-03-06 09:56:58
|
I'm using: /** * Public constructor. */ public Application() { super(); ERDirectToWeb.initialize(); setPageRefreshOnBacktrackEnabled(true); setDefaultRequestHandler(requestHandlerForKey=20 (directActionRequestHandlerKey())); WOMessage.setDefaultEncoding("UTF-8"); WOMessage.setDefaultURLEncoding("UTF-8"); ERXMessageEncoding.setDefaultEncoding("UTF8"); ERXMessageEncoding.setDefaultEncodingForAllLanguages("UTF8"); } and it just works. Cheers, Anjo Am 06.03.2006 um 10:52 schrieb P=C4=93teris Kri=C5=A1j=C4=81nis: > I try to INSERT/SELECT UTF-8 strings from PostgreSQL database, using > Postgresql JDBC driver and PostgresqlPlugIn. However, I have problems > with that when I set Application.java/Session.java hack for UTF-8 > enconding - when I set them[1], database records are just fine (I can > see them in UTF-8 encoding using Browsing Data mode in pgAdmin =20 > III), but > they doesn't appear right in dropdown menus, WOStrings, etc. when I =20= > get > them from database and put into the page. > > When I remove hacks, they appears on the page just fine, BUT in =20 > database > Browsing Data mode appears to to have symbols like UTF-8 strings =20 > viewed > in ASCII code (2 strange symbols for one UTF-8 one). > > So question is - is there somewhere a problem? My guess it could be > EOModel where I should set correct encoding for database. How to do > that? > > [1] Application.java/Session.java hack for correct UTF-8 symbols: > > Application.java: > public void appendToResponse(WOResponse response, WOContext =20 > wocontext) { > super.appendToResponse(response, wocontext); > // This must be done after the page generation to override the =20 > default > header created by WO during the page generation. > if > (_NSUtilities.UTF8StringEncoding.equals(response.contentEncoding())) > response.setHeader("text/html; charset=3DUTF-8", "content-type"); > } > public WOResponse createResponseInContext(WOContext > wocontext) { > WOResponse woresponse =3D > super.createResponseInContext(wocontext); > woresponse.setContentEncoding(_NSUtilities.UTF8StringEncoding); > return woresponse; > } > > ----------- > and if you have some form that may use umlaut characters, also add =20= > this > in > your Session.java: > ----------- > > public void takeValuesFromRequest(WORequest aRequest, WOContext > aContext){ > aRequest.setDefaultFormValueEncoding=20 > (_NSUtilities.UTF8StringEncoding); > super.takeValuesFromRequest(aRequest, aContext); > } > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting =20 > language > that extends applications into web and mobile media. Attend the =20 > live webcast > and join the prime developer group breaking into this new coding =20 > territory! > http://sel.as-us.falkag.net/sel?=20 > cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D121642 > _______________________________________________ > Wonder-disc mailing list > Won...@li... > https://lists.sourceforge.net/lists/listinfo/wonder-disc |