SQLite Database Browser - problem with importing national fonts - android

I'm using SQLite database in my android project. I want to store there lots of string containing polish fonts. To manage the database I'm using SQLite Database Browser. The problem is: when I'm importing csv filled with strings to database, my text gets changed from, for example "Wysyłaj własnoręcznie" to "Wysy³aj w³asnorêcznie". Any ideas how to properly convert this kind of characters?

Presumably you are opening an InputStream to some source for the csv text, then wrapping that in an InputStreamReader. You need to specify the proper encoding when creating the InputStreamReader. The default encoding is probably ISO-8869-1 and your text is probably UTF-8. This would explain why characters beyond U_007F are not interpreted correctly.

Related

Fetching German characters from SQLite database in Android

I'm having difficulty fetching "special"/German characters (i.e. "öäüß") from my SQLite database using Android.
I'm using the SQLiteOpenHelper class to access the database and the characters show up as either a space or a rectangle.
I can select the fields in Command Line and they display properly, so I assume that they're stored correctly? However, I've used a number of GUI SQLite clients (SQLite Database Browser, sqliteman, Firefox's SQLite client) and none of them have succeeded in displaying the characters properly, so that seems odd, but the real problem is that they don't show up correctly in my app.
I have tried adding:
System.setProperty("file.encoding", "UTF-8")
and
System.setProperty("file.encoding", "ISO-8859-1")
I'm not entirely sure what this means, but I saw it mentioned in related posts so I'll include it:
SELECT hex('ä'); returns 84 and SELECT typeof(data) returns text.
Thanks very much!
84 is not the correct UTF-8 encoding of ä.
The Windows command prompt does not properly support UTF-8.
If you have entered the data from there, the encoding will be wrong.
Use the .read command to read the data from a UTF-8-encoded file, or enter the data with any of the GUI tools, which handle UTF-8 correctly.

How to convert the data in Android DBs to rdf data?

I'm trying to extract rdf data from android DB.
It means that I want to get rdf data from contacts DB, callendar DB, and so on directly.
I know that the current android platform have used SQLite DB.
Is it available to extract rdf data?
Surely, I can make the same data typed of rdf manually.
Here, My converting criterion is that the table name means Subject of rdf, the column name means Predicate, and the value means Object.
But the important issue is how to convert data in the existing data in Android DB to RDF data automatically.
I found that the tools such as AndroJena, uJena, Sesame... don't support that functionality.
Help me plz.
PS)
I searched many posts here and I found that someone had stuggled with the similar problem.
He got the solution like below.
First, Copy ur android DB on your own DB in desktop.
Second, Nomalize the copied DB.
Third, Make rdf triples by utilizing the modified DB.
3.1. By referencing such papers titled as RDB to RDF and following the defined converting rules from those, convert data to the data typed of RDF.
Above solution is the only answer?
The general question of converting from a relational DB to RDF was covered by W3C's RDB2RDF working group. This group finished the standards they produced in 2012.
There are two styles, to just directly map to RDF (Direct Mapping) or to map using mapping rules in R2RML. If you convert directly then you can use all your favorite tools to map into the ontology want.
See the Implementation report for a list of implementations at the time it was written. There may be many other bits of software kicking around the web which do this sort of thing, which have been produced more recently or were not spotted then by the group.
The whole RDB2RDF issue is still very much under development. However, D2RQ precedes this discussion and we found this a useful tool to 'automatically' go from RDB to RDF. This only requires a mapping. The code is all in Java, so it is probably possible to adapt it and deploy it to your android phone.
A few notes: D2RQ is not under development anymore (as far as I know) and you still have to make a mapping on how to translate the relational database to rdf.

How to convert json unicoded value to other font's unicode?

I have data with local font in my database. I can extract it successfully in php (displaying the same local word in webpage). Now, I want to send this data using JSON so that it can be accessed by Android app. While encoding in JSON, is it possible to encode in different font's unicode?
After retrieving JSON encoded values, the word can be displayed in font A (but in broken format). But I want to show it using font B (so that broken stuffs are solved in this).
So, is there any way to encode using different font so that I can fix my issue ?
Thanks.
So, is there any way to encode using different font so that I can fix my issue ?
No. Unicode strings contain only plain semantic text. There are no markup constructs in it that would allow you to choose a different font; that has to be provided by a layer above text such as HTML.
the word can be displayed in font A (but in broken format). But I want to show it using font B (so that broken stuffs are solved in this).
The app that consumes the JSON and displays data from it must be altered to display using Font B.
Note that Android support for Indic scripts has historically been notoriously poor and still suffers from bugs; prior to the 4.x series you will probably be missing any kind of Font B or even correct Devenagari glyph layout.
By definition, JSON must be encoded in UTF-8.
When you talk about font, I assume you are talking about encoding - text by itself does not specify which font will be used to render it on user screen. Best option is to always store your data in UTF-8, so you don't have to recode anything. All open-source databases (PostgreSQL, MySQL, etc) provide a way to store text in UTF-8 by default. Also, Android uses UTF-8 by default for all strings (JSON, XML, etc).
If you data is encoded in some legacy encoding (like CP1250 or CP1251), your should use appropriate method to convert that encoding into UTF-8 before creating JSON. Almost every platform provides a way for such conversion. One of the popular libraries for this is iconv (it has bindings for PHP, C/C++, etc), but I am sure there are many other ways to accomplish that.

MySQL database and Web service for Android App

While using MyPHP admin, I edit records in mySQL database that then is updated into my Android application.
If I paste data into one of my table fields, I often get "NULL" displaying in my app. If I paste the web service URL into a browser I still get the NULL value for that particular field.
After further experimenting, I noticed that editing some characters, that tend to be non-standard, the NULL is replaced with my data. This characters seem to be apostrophes, dashes, and brackets...etc.
Is there some way to do a mass conversion so all my data will paste into my table without editing special characters?
I have tried pasting into Notepad and other editors with the same result.
I then tried various means to ensure my tables were using utf8 character set. This yielded no data to my app. (the Browser method still worked). I don't remember adding anything to my app that set the charset.
Any ideas?
Thanks!
Hard to judge without sample data, url, etc. But I would say, given that this data will be displayed on a mobile device, that you probably would need to paste your data into something like TextWrangler, or NotePad++ and you will have to do a regular expression find and replace on all of the special characters. When you're finished, you would have to reimport into your database.
Another solution is to filter out the special characters right on the server. You could use the PHP str_replace function to filter out special characters as well.
I hope this helps!

Searching a SQLite database which contains cyrillic data

I have a problem searching my SQLite database, which contains data written with cyrillic characters. If the key word is also cyrillic, then everything is ok, but if not, then I can`t get the result in my Android application.
Does anyone have an idea how can I implement searching the cyrilic data no matter the charset of the keyword?
Thanks
If you use UTF8 encode, There will be no problem.
Actually not. String comparison works only with ascii characters (sort, upper, lower and like). If you are using non-ascii chars you should install plugin, which is like whole SQLite in size. Proof.
If you are interested in cyrillic symbols, try this link.
If you use UTF8 encode, There will be no problem.

Categories

Resources