473,218 Members | 1,477 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,218 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 3565
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.