简体   繁体   中英

Why playframework 2.0.3 shows unrecognizable characters for compilation errors in controllers?

I am starting a new app using Play Framework 2.0.3, but I find that if there is a compilation error in the Controller, the error messages fail to show after refreshing the browser. Instead, there are some unrecognizable characters shown in the browser.

For example, I add a semicolon in the controller:

public class ; Application extends Controller {

  public static Result index() {
    return ok(index.render("OK."));
  }
}

After refreshing , the browser shows:

Compilation error
��Ҫ <��ʶ��>

However, if I made some errors in the View or Route, the correct error message can be shown in the browser.

My environment: [Files encoding: utf-8 without BOM, OS: Windows XP chinese version, Browser: Chrome English version ]

Can any body give me some tips as how can I diagnose this problem?

I found the answer here :

Find build.bat from play installation directory (mine is in D:\\play-2.0\\framework ).

Edit it with text editor, change %DEBUG_PARAM% -Dfile.encoding=UTF-8 to %DEBUG_PARAM% -Dfile.encoding=GBK

Reboot play framework.

Use some IDE to work with code, it will show you syntax errors before you will try to run it, and will save lot of your time.

for this problem, remove the semicolon after class world.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM