BlackBerry webworks native dialog unicode - blackberry

I have been searching for an answer all around the web, but couldn't find anything.
I am developing Blackberry Webworks application and the problem is with dialog and unicode. For example:
when I use simple javascript alert(unicodeMsg); unicode works fine, I can use any character including Russian or Lithuanian. The problem is that the alert box has title "JavaScript Alert" and it annoys a bit.
when I use native alert either phonegap or webworks like:
blackberry.ui.dialog.standardAskAsync(unicodeMsg,
blackberry.ui.dialog.D_OK, {
title : unicodeTitle,
size: blackberry.ui.dialog.SIZE_MEDIUM,
position : blackberry.ui.dialog.CENTER
});
it doesn't show any unicode characters. I tried pretty much everything (setting my document in utf-8, using \uxxxx characters, changing meta tags from utf-8 to windows-1257 but nothing works)
I suppose the problem is not with html or js documents neither with the script. Can someone help me?

You need to encode the unicode characters like so text: unescape(encodeURIComponent(unicodeStr)) .
There is an example here - http://blackberry-webworks.github.com/WebWorks-API-Docs/WebWorks-API-Docs-next-BB10/view/blackberry.invoke.html

Related

Delphi 7 cyrillic characters not showing correctly

i recently asked (and paid) for translation of my Delphi app to support Macedonian (Cyrillic font) support.
I posted text to translate to my contracted translator, she sent me back translated strings. The text was extracted from all my .dfm and .pas files
when i replaced the original text with cyrillic translation, i can open .dfm fies also .pas files in my favourite Notepad++ (or notepad) , and i see translated characters correctly.
When i open these files in Delphi (as dpr file) , i see something like this:
Please someone tell me how to convert/display these strings in Delphi correctly.
I am using Macedonian regional settings, but it not helped me with this problem.
PS: Yes I am still using Delphi 7 because i love it / purchased this version.
UPDATE
Original text in Delphi:
original: ПОДГОТВИ КУТИИ ЗРДРУГИТЕ ЦЕÐТРÐЛИ
Correct text:
ПОДГОТВИ КУТИИ ЗА ДРУГИТЕ ЦЕНТРАЛИ
I noticed, when i change ParentFont property to false and font set to Verdana and Cyrillic (RUSSIAN_CHARSET) , then i copy/paste cyrillic text, it shows normally in Delphi
OK so i SOLVED that!
The solution is multi step one, and Notepad++ is needed:
1st step: Replace all fonts in .dfm with (for example) Verdana , or some font that allows Cyrillic support
2nd step: Replace all ParentFont = False to ParentFont = True
3rd step: In notepad++ Choose: Encoding -> Convert to ANSI
that's all, do this for all .dfm and .pas file (only 3rd step)
i am happy to not Listened David Heffernan and not gave up!
Your text file was UTF-8 encoded, whereas Delphi7 requires WinAnsi encoding, with codepage 1251 for Cyrillic characters.
You have the UTF8Decode() function in System.pas to make the conversion programmatically, if you prefer.

Slack slash command results in different encoding coming from iOS app or MacOS App

We have a Slash command integration and discovered that the text passed to the slash command is encoded differently if it comes from the (iOS) mobile app compared to the Desktop app.
For the command "/whereis #xsd" on the MacOS Desktop app, the text element in the body is encoded as: text=%3C%23C02MKG1LH%7Cxsd%3E
For the command "/whereis #xsd" on the iOS app the text element in the body is encoded as: text=%26lt%3B%23C02MKG1LH%7Cxsd%26gt%3B
The iOS app is incorrect.
Did anyone else experience this? Any solutions?
(I have posted this question to Slack, they confirmed the behavior a while back but no solution from them so far).
This is not a bug. Both are valid HTML encodings. You can verify this by decoding them on this website.
The difference is that the string from IOS also includes an encoding of HTML special characters (like <) but the desktop string does not. To address this your app has to first do a URL decoding of the input string and then decode special HTML chars.
The results are:
Desktop: <#C02MKG1LH|xsd>
IOS: <#C02MKG1LH|xsd>
Here is a sample code that will decode both strings correctly in PHP:
<?php
function decodeInputString($input)
{
return htmlspecialchars_decode(urldecode($input));
}
$desktop = "%3C%23C02MKG1LH%7Cxsd%3E";
$ios = "%26lt%3B%23C02MKG1LH%7Cxsd%26gt%3B";
$desktop_plain = decodeInputString($desktop);
$ios_plain = decodeInputString($ios);
var_dump($desktop_plain);
var_dump($ios_plain);

Why numbers getting reversed when formatted in RTL Arabic - Rails application?

I'm using Prawn gem in my Rails app to generate PDF reports.
I read the documentation for putting the text in Arabic with text_direction RTL in arabic.
But, issue is that numbers are getting reversed here.
I wanted semester 1234 as الفصل الدراسي 1234,
but in my app the output is الفصل الدراسي 4321.
My two lines of code is here:
pdftable = Prawn::Document.new
pdftable.text(t('org.semester') + " " + #semester)
#semester = '1234' (The reason would be that it is being treated as a text/string, thus changes to RTL (reversed))
Anyway, Please help me to retain numbers in proper order without changing the RTL format.
Without hacking too much you could use
#semester.to_s.reverse
So you reverse the string twice

html2pdf and local (latvian) language characters

I am using Html2PDf to convert html to pdf.
But I am not able to achieve that it shows local (latvian) language letters. It shows ? instead.
I do understand that I should somehow add appropriate fonts, but I do not know where to get those fonts (which one support latvinan language) and how to add them into html2pdf.
Html2Pdf is based on tcpdf and currently there is font folder.
I think that is seems trivial question, but I was searching via google, but have not found answer that works for me.
require_once('inc/html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','en');
//$html2pdf->pdf->setDefaultFont('times');
// HEADER
$pdf_output .='<page style="font-size: 11px; >';
$pdf_output .= '<img src="images/raka_pdf_logo.png" alt="logo"/><br><br><br><br>';
...
You may find the right font-family in html2pdf>tcpdf>fonts

I want to export csv file that contains hebrew character in my ASP.net MVC application

I want to export csv file that contains hebrew character in my ASP.net MVC application
I have tried many encoding but not work. Actually hebrew characters and not displaying as they are.
Can anybody have idea?
System.Text.UnicodeEncoding Enc = new UnicodeEncoding();
HttpContext.Current.Response.AddHeader("Content-Length", Enc.GetByteCount(strExport).ToString());
HttpContext.Current.Response.BinaryWrite(Enc.GetBytes(strExport));
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1255");
//HttpContext.Current.Response.Charset = "iso-8859-8";
HttpContext.Current.Response.ContentType = "text/csv";
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment;inline; filename={0}.csv", fileName));
HttpContext.Current.Response.End();
Check this out and see if setting the encoding helps: http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx
Once upon a time we had multiple clients, including Hebrew, text files for import into MySQL, Sql Server, etc. The company had standardized on UTF8 as the encoding for everything. That was a few years ago, so ymmv.
Might be easier to debug if you show us a code sample.

Resources