x11 Posted May 3, 2021 Share Posted May 3, 2021 В таблице валют есть обозначение валюты ₳ или ₴ в виде символа юникода utf-8 (картинка 1 uniDBGrid). Проблема в том, что на мобильной форме отображается знак вопроса вместо символа (картинка 2). В этом случае данные выводятся с помощью шаблонизатора и js '<span class="tdDbgRowPrice">{[this.getVal(values, "CURRNSIGN")]} {[this.getVal(values, "PRICE")]} {[this.getVal(values, "CURRNABBR")]}</span><span class="tdDbgRowPriceCurr">{[this.getVal(values, "PRICE_CURRENCY2")]} {[this.getVal(values, "CURRENCY_NAME")]}</span>'+ ... ... ... getVal: function(val, fieldName) { if (sender.fieldsNames.indexOf(fieldName) >= 0){ return val[sender.fieldsNames.indexOf(fieldName)]; } else { console.error(fieldName + " not found"); } проверил delphi-код в отладчике и вижу, что символ передается правильно. может нужно в какой-то специальной кодировке этот символ передавать в браузер? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Здравствуйте, А другие unicode символы отображаются корректно? Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 заменил на обычную букву "г" - отображается Потом заменил на расширенную латинскую букву "ƙ" - опять знак вопроса. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Какой charset (БД) используете? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Unicode_fss? Вы используете FireBird? Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 Пытался перекодировать с помощью UTF8ToUnicodeString procedure TfmmPurchase.qDataCalcFields(DataSet: TDataSet); begin inherited; DataSet.Fields[fIdxCURRENCY_ASIGN].AsString := UTF8ToUnicodeString(UniMainModule.AppSettings.CurrNSign); DataSet.Fields[fIdxCURRENCY_ABBR].AsString := UniMainModule.AppSettings.CurrNAbbr; end; всё равно знак вопроса Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 AsWideString? Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 Just now, Sherzod said: Unicode_fss? Вы используете FireBird? нет, utf-8, но сам ведь delphi-приложение юникодное, а не utf-8, т.е. в настройках подключения к базе я указіваю кодировку. И, как я ранее сообщил, в uniDBGrid отображается нормально. Подозреваю, что нужно как-то перекодировать в js-кодировку Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 Just now, Sherzod said: AsWideString? нет, не помогло Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 В Delphi WideString и String вроде бы одно и то же? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Я также использую БД FireBird. Использую кодировку unicode_fss при создании базы. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Можете создать простой тестовый случай? Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 дело не в шаблонизаторе, потому что unimDBListGrid тоже отображает ? вместо юникодного символа Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Проблема в кодировке. Quote Link to comment Share on other sites More sharing options...
x11 Posted May 3, 2021 Author Share Posted May 3, 2021 В общем, при создании тестового примера я обратил внимание, что persistent-поля датасета создаются не TStringField, а TWideStringField. Я у себя переделал поля тоже на TWideStringField и проблема ушла. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 3, 2021 Share Posted May 3, 2021 Ок. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.