Fetching German characters from SQLite database in Android - 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.

Related

When an sqlite3 query returns ? for some character, what does this mean about the underlying data? How do I view that data in its unicode form?

I'm receiving: ������ back from sqlite3 queries, and I'm trying to determine what that means about the underlying data. These characters are supposed to be Cyrillic alphabet characters. These queries are on my desktop.
I am attempting to render them on an Android application, however the values returned from the related queries in the Android application (when viewed in the debugger at-least) are:
\u0003Ȓ\u0001-500-300
In the text view I show them in I see a number of empty squares.
I believe there must be some kind of encoding issue somewhere, but I'm sure how to check and see what actual values are stored in the db, vs what I'm getting back etc...

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.

Why won't my mysql database accept an accent mark?

I've just discovered an issue where city names that contain accent marks, e.g. La Cañada, Peñasco, etc., won't save to my database. Looking through the answers to another SO question, What is the best collation to use for MySQL with PHP?, I've tried changing both my database and the varchar's collation type from latin1_swedish_ci to utf8_general_ci which still refused the character. I also tried utf8_unicode_ci with a similar result.
I've verified that the save works if I strip out the accent mark on the client side, but ideally I'd like to keep it in there, since that is the real name of the city (according to google maps apis anyway).
What collation types do you use to support ñ?
Additional info: Using MySQL, phpMyAdmin, and CakePHP with an Android app as the client
Thanks for the suggestions so far. I guess this is turning into a CakePHP question now... I noticed that by default utf8 is not enabled, so I enabled it in my app/config/database.php file. I FTPed the file back to the server and tried it again still without any luck. Do I need to redeploy the application to kick off those db config changes, or is there another area of my application I should check? First time CakePHP user here.
Collation is merely the order in which characters are sorted, which is a necessary step in performing comparisons. It has nothing to do with how data is stored (except insofar as a given collation is specific to some encoding).
Character encoding is the mapping of characters to their binary representation for storage, which determines the supported character set.
However, just because a database/table/column are using a particular character encoding is not the end of the story. You must also consider the encoding used within your application and on its interfaces with other components (such as MySQL).
Whilst it's aimed at PHP, UTF-8 all the way through pretty much covers all of the things you need to consider.

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!

SQLite Database Browser - problem with importing national fonts

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.

Categories

Resources