Thanks for the extra digging, Yasuo. Feel free to file a bug in the issue tracker regarding the default character encoding issue:
http://code.google.com/p/googleappengine/issues/list - Jason On Mon, Sep 14, 2009 at 7:13 PM, Yasuo Higa <[email protected]> wrote: > > Hi Jason, > > Thanks for your reply. > > On Tue, Sep 15, 2009 at 8:21 AM, Jason (Google) <[email protected]> > wrote: > > You should add a filter that calls request.setCharacterEncoding() and > sets > > the appropriate encoding before handling the request. If you query for > the > > data without startsWith and display it on-screen, do you see what you > expect > > or is it garbled? > > > I call request.setCharacterEncoding("UTF-8"), > and my JSP is not garbled. > > I think the cause is DatastoreQuery#getUpperLimitForStartsWithStr(). > In the method, val.getBytes() is called. > String#getBytes() depends on default charset encoding. > "Shift_JIS" is used on my local server, > but an another charset encoding may be used on production server. > > The following code may work fine: > private Literal getUpperLimitForStartsWithStr(String val) { > return new Literal(val + "\ufffd"); > } > > > Also, make sure you add this line after declaring the Query: > > > > query.declareParameters("String content"); > > > I use implicit parameter as :content. > > Thanks, > > Yasuo Higa > > > > - Jason > > > > On Sat, Sep 12, 2009 at 10:32 PM, Yasuo Higa <[email protected]> > wrote: > >> > >> Hi all, > >> > >> JDO startsWith for Japanese works fine on development server, > >> but it does not work on production server. > >> > >> The following url is my test application. > >> http://2.latest.higayasuo.appspot.com/blog/ > >> > >> Test code: > >> Query query = pm.newQuery(Blog.class, "content.startsWith(:content)"); > >> List<Blog> blogList = (List<Blog>) > >> query.execute(request.getParameter("content")); > >> request.setAttribute("blogList", blogList); > >> > >> Blog.java: > >> @PersistenceCapable(identityType = IdentityType.APPLICATION) > >> public class Blog { > >> > >> @PrimaryKey > >> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > >> @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", > >> value = "true") > >> private String key; > >> > >> @Persistent > >> private String title; > >> > >> @Persistent > >> private String content; > >> > >> ... > >> } > >> > >> My jsp's encoding is UTF-8. > >> > >> Is there a workaround? > >> > >> Thanks, > >> > >> Yasuo Higa > >> > >> > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---
