Dartlang with polymer character encoding

后端 未结 2 672
走了就别回头了
走了就别回头了 2020-12-20 05:48

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:

相关标签:
2条回答
  • 2020-12-20 05:59

    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;
    ...
    
    0 讨论(0)
  • 2020-12-20 06:06

    A while ago I posted the code for a <safe-html> tag at HTML Tags Within Internationalized Strings In Polymer.dart (original form Bind content containing html tags)

    Using this polymer element shows proper characters.

    Your login.html would then look like:

    <link rel="import" href="../packages/safe_html/safe_html.html">
    
    <polymer-element name="login-element" attributes="loginrow">
      <template>
        ...
        <div>
          <input type="text" value="{{torzsszam}}">
          ...
          <br>
          <span>(<safe-html model="{{loginstatus}}></safe-html>)</span>
        </div>
      </template>
      <script type="application/dart" src="login.dart"></script>
    </polymer-element>
    
    0 讨论(0)
提交回复
热议问题