473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

convert string function and built-in conversions

It seems to me that these values should be the same:

select 'lydia eugenia treviño', convert('lydia eugenia treviño' using
ascii_to_utf_8);

but they seem to be different. What am I missing?

culley

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
3 3581
On Sun, 19 Oct 2003, culley harrelson wrote:
It seems to me that these values should be the same:

select 'lydia eugenia treviño', convert('lydia eugenia treviño' using
ascii_to_utf_8);

but they seem to be different. What am I missing?


I don't think the marked n is a valid ascii character (it might be
extended ascii, but that's different and not really standard afaik).
You're probably getting the character associated with the lower 7 bits.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2
It is one of the extended characters in iso-8859-1. This data was taken
from a text field in a SQL_ASCII database. Basically what I am trying to
do is migrate data from a SQL_ASCII database to a UNICODE database by
running all the data through an external script that does something like:

select convert(my_field using ascii_to_utf_8) from my_table;

then inserts the selected text into an identical table in the unicode
database. All the data goes across, but extended characters such as ñ
are getting munged. The docs indicate that ascii_to_utf_8 is for
SQL_ASCII -> UNICODE... Are you saying that ñ isn't really an ASCII
character even though it is valid in a SQL_ASCII database? I have found
that all extended characters of the various LATIN encodings will work
just fine in my SQL_ASCII database.

This project is a big can of worms... Every 6 months I open the can,
stir the worms around a bit, wrinkle my nose then promptly close the can
again and stuff it away for another 6 months. :) Wish I could figure it
out.

On Sun, 19 Oct 2003 00:31:43 -0700 (PDT), "Stephan Szabo"
<ss****@megazone.bigpanda.com> said:
On Sun, 19 Oct 2003, culley harrelson wrote:
It seems to me that these values should be the same:

select 'lydia eugenia treviño', convert('lydia eugenia treviño' using
ascii_to_utf_8);

but they seem to be different. What am I missing?


I don't think the marked n is a valid ascii character (it might be
extended ascii, but that's different and not really standard afaik).
You're probably getting the character associated with the lower 7 bits.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3
On Sun, 19 Oct 2003, culley harrelson wrote:
It is one of the extended characters in iso-8859-1. This data was taken
from a text field in a SQL_ASCII database. Basically what I am trying to
do is migrate data from a SQL_ASCII database to a UNICODE database by
running all the data through an external script that does something like:

select convert(my_field using ascii_to_utf_8) from my_table;

then inserts the selected text into an identical table in the unicode
database. All the data goes across, but extended characters such as ñ
are getting munged. The docs indicate that ascii_to_utf_8 is for
SQL_ASCII -> UNICODE... Are you saying that ñ isn't really an ASCII
character even though it is valid in a SQL_ASCII database? I have found
that all extended characters of the various LATIN encodings will work
just fine in my SQL_ASCII database.


I would guess that it's not actually forcing/checking the characters for 7
bitness in SQL_ASCII, but that the conversions are treating them as if you
had actually only put in valid 7 bit values (as they appear to be doing
an & 0x7F in at least the routines I looked at).

If you're actually putting iso-8859-1 (latin1) in there, try the
conversion from iso-8859-1 to utf8. It doesn't appear to display properly
in my iso-8859-1 terminal, but taking that string and inserting it into a
unicode database and then setting my client_encoding to iso-8859-1 gives
me the original string back when I select it.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark S Pryor | last post by:
Hello, Using MySQL 4.017 on Win2k sp3: using MySQL built-ins: how can I convert a value stored as a hexadecimal string back to a binary string while logged into the shell? >set @t1=616263;...
1
by: phancey | last post by:
I am trying to invoke a web service method dynamically. I have created a generic function that takes a method name, string of parameters and calls the web method using System.Reflection: ...
6
by: Red Devil | last post by:
I have a class containing string variables, hashtables..I managed to serialize it into a memory stream instead of file stream. Would like to know how can I convert the byte array to string. I tried...
4
by: Jason Huang | last post by:
Hi, I would like to convert the following Visual Basic code to C#, does someone has free tool to convert it? Function PreConnect() As Boolean Dim strDSN$, strUidPwd$, strDatabase$,...
4
by: simon | last post by:
I have datetime variable: DateTime datum; I set it and when I try to put it into a label: labelDate.Text =datum.ToShortDateString; I get an error:
19
by: simon | last post by:
I get from the dateTimePicker the value: string="12/18/2003 11:52:28 AM" Now I need to convert this to dateTime. Any function I use: Convert.ToDateTime(string) or Cdate(string), I get an error...
15
by: JenHu | last post by:
Hi expert, I have a data field (birthdate) contains a datetime datatype (mm/dd/yyyy), how can I convert to mmdd?? say, the birthday is 8/1/1979 and convert to mmdd DOB =...
3
by: priyanka | last post by:
Hi there, I want to convert a String into integer. I get the string from a file using : string argNum; getline(inputStream,argNum); I now need to convert argNum into integer.
1
by: gdavid | last post by:
Hi. I Have started using Visual C++ 2008 a month ago. I Tried to make a GUI calculator but i cannot convert the textbox's text with the atof() function. The function cannot convert String^ type into...
3
by: mamul | last post by:
Hi please some one can help me. how to convert char * to string? i have take char *argv from command line and want to pass to a function as string object(string str) i want to first convert argv...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.