How to convert UTF8 to string using string functions in Greenplum - greenplum

I have a source table where free form text entered via an front end application gets stored as VARBINARY (SQL Server). While loading Greenplum the field was cast into VARCHAR field. Loaded as a UTF8 value, I am facing issues in encode/decode this field into a meaningful text.
Couple of things I have tried till now, used PSQL 8.2 String functions and the UTF-8 decodes online tools to understand the expected result.
Encoded to base64 but that still produces the utf-8 value only
SELECT encode('0x205361742046656220312031363A32313A303320 utf-8','base64');
--Output
--MHgyMDUzNjE3NDIwNDY2NTYyMjAzMTIwMzEzNjNBMzIzMTNBMzAzMzIwIHV0Zi04
Using an UTF8 decode online tools, if run this '0x205361742046656220312031363A32313A303320' through the decoder - it produces ' Sat Feb 1 16:21:03 ' and that is my expected result.
Any advice/help is appreciated. Thanks!

Related

MySQL column encryption with Hibernate in Spring MVC

I need to encrypt data saved onto my DB. I am currently using spring and hibernate to save data.
I have looked at some materials and tried to implement the code, however, it has resulted in various generic errors, some of the material was not targeted to MySQL etc.
Here's the code that has got me furthest
#Column(name="disability_description")
#Length(max=500)
#ColumnTransformer(
read = "AES_DECRYPT(disability_description, 'mykey')",
write = "AES_ENCRYPT(?, 'mykey')"
)
private String disabilityDescription;
This, however, doesn't work as I get the following errors
org.hibernate.exception.GenericJDBCException: could not execute statement
java.sql.SQLException: Incorrect string value: '\xF9\x82u\x01\x99\x1A...' for column 'disability_description' at row 1
Please point in the right direction. I am lost. Also mykey doesn't point to anything, I just entered a random word.
I doubt that your column is not of type BINARY:
Mysql Doc:
AES_ENCRYPT() encrypts the string str using the key string key_str and
returns a binary string containing the encrypted output.

turkish char comes as numerical code after oracle select of nclob field

I have an NCLOB field in the database, which I use to save data created using the fck editor.
Certain Turkish characters are displayed as numerical codes after doing an Oracle select from this NCLOB field . For example: the Ç character becomes Ç.
How can I solve this without having to use text replacement?
Who will use the data that is retrieved from the database after the select? If it will be displayed using the FCK editor, there should be no problem.
Otherwise, you need to use a different encoding (I don't know about FCK editor so I don't know if this is possible).
Or, you need to use a different editor (other than FCK) that will read/write in the proper encoding.
Therefore, decide who will be using the data; that is, what software will they be using to display the data coming from the NCLOB field (for example, Microsoft Word, Notepad, or some other application).
Using that application, create a file that contains Turkish characters.
Write that file into a NCLOB field.
Retrieve the file back and try to display it using the same application.
Make sure the characters are the same and that Oracle has not transformed the Turkish characters.
If all works well, use that application to store data into NCLOB fields.

How do I convert these characters to their readable form

I have some columns in my oracle database table which is having some �� in them.
How do I decode it to it's original readable form.
I know it's is related to encoding but I need to find a solution for this.
In my php application I get those characters as plain '??'.
I am using sql developer to view records.
You have to convert them from UTF8 to your current encoding. Or vice versa.

Storing issue for special character in table in rhomobile

using CGI escape i able to save some special character in DB. But I faced a critical issue related to column size.
In one case data size in one column is 12 character. when user inserted 11 spacial character in a view form. then if I escape those spacial character and try to save those whole string in DB, then it is giving a error and that is because of the length if character after escaping 11 spacial character is more than table'c column size(i.e 12 char).
How to solve this type of error ?
Here is the documentation for storing in Database with RhoMobile.
Using the Local Database with Rhom

Everything is in utf8, but text isn't recording correctly to db anyway

I've created a database (with utf8 charset) and a table with the same charset, all the rows are utf8, in webpage I have meta tag for utf8... But anyway, when I type in my forms smth not in latin alphabet, it registers in db wth eg. фывфыÐ
Have I missed something?
Try use such code after connecting to DataBase, but befor you recieve/write data
$db->query('set character_set_client=utf8');
$db->query('set character_set_connection=utf8');
$db->query('set character_set_results=utf8');
$db->query('set character_set_server=utf8');

Resources