Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

dart - Dartlang with polymer character encoding

I wrote a snippet and not working with national characters. The "A t?rzsszám"... text appear "t??rzssz??m" with my loginstatus field.

Main html:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="hu" xml:lang="en">
  <head>
  <meta charset="utf-8">
....

Login.html

<polymer-element name="login-element" attributes="loginrow">
  <template>
    ...
    <div>
      <input type="text" value="{{torzsszam}}">
      ...
      <br>
      <span>({{loginstatus}})</span>
    </div>
  </template>
  <script type="application/dart" src="login.dart"></script>
</polymer-element>

..and the login.dart snippet:

@CustomTag('login-element')
class Login extends PolymerElement {
  bool loginned = false;
  @published String torzsszam = "";
  @published String password = "";
  @published String loginstatus = "-";

  ...

  void log_in_click() {
    loginstatus="LOGIN";
    loginned = false;
    if (torzsszam != "" ) {
      if (torzsszam.length>8) {

        loginstatus='A t?rzsszám legfeljebb 8 számjegyb?l áll!';
      } else {

What can I do...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ups,... I tried some solutions:

1.solution: change the encoding properties in login.dart from utf-8 to ISO-8859-2

2.solution: I created another file (consts.dart)

class consts {
  static String loginstatus_err8 = "A t?rzsszám legfeljebb 8 számjegyb?l áll!";  
  static String loginstatus_OK = "Belépve";  
  static String loginstatus_emptytorzsszam = "A t?rzsszámot ki kell t?lteni";
}

I used this in login.dart, and it worked :) I'm happy.

...
        loginstatus=consts.loginstatus_err8;
      } else {

        loginstatus=consts.loginstatus_OK;
...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...