Reputation: 139
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...
Upvotes: 1
Views: 453
Reputation: 139
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;
...
Upvotes: 2
Reputation: 657058
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>
Upvotes: 1