|
-
Jul 17th, 2008, 12:00 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Unicode variable
I'm trying to download few movie names and save it to database. But when I'm reading title from page sourcecode, and there is for eg. french symbol, i have in database something like this: "è" (it works on forum... I have "& # 232;"). How can I get right name?
Code is like this:
Code:
strSource = myClient.DownloadString(strUrl)
strTitle = Functions.GetTitle(strSource)
strTitle = strTitle.Replace("'", "''")
comCommenda.CommandText = "INSERT INTO IMDB_list (Name, Url, [File]) VALUES ('" & strTitle & "','" & strUrl & "','" & strFile & "')"
comCommenda.ExecuteNonQuery()
GetTitle is simple function to get title from source code.
-------------------------------------------------------------
I found, that in source code is "& # 232;" 
So other question, how to display it in MS Sql 2005 as è ?
Last edited by Ivenesco; Jul 17th, 2008 at 12:03 PM.
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
-
Jul 17th, 2008, 12:14 PM
#2
Re: [2005] Unicode variable
set datatype of Name column as nvarchar in Database
__________________
Rate the posts that helped you 
-
Jul 17th, 2008, 12:23 PM
#3
Thread Starter
Hyperactive Member
Re: [2005] Unicode variable
It is nvarchar... I think, in this command sql see text as #&2... not as uniocode.
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
-
Jul 17th, 2008, 12:32 PM
#4
Re: [2005] Unicode variable
BTW, I think that dowloading content from IMDB and saving it locally is something that they don't encourage. If that's the case, they will probably block your IP after you reach a certain limit of HTTP requests, and they probably will also have ways of doing the same thing if you go through a proxy.
-
Jul 17th, 2008, 12:37 PM
#5
Thread Starter
Hyperactive Member
Re: [2005] Unicode variable
I don't care My problem is to get unicode char instead of this numbers.
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
-
Jul 17th, 2008, 12:39 PM
#6
Re: [2005] Unicode variable
can you post myClient.DownloadString function's code ?
__________________
Rate the posts that helped you 
-
Jul 17th, 2008, 12:47 PM
#7
Thread Starter
Hyperactive Member
Re: [2005] Unicode variable
It's framework function 'myClient' is Net.WebClient
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
-
Jul 17th, 2008, 01:13 PM
#8
Re: [2005] Unicode variable
You are downloading the HTML source. & #233; is valid html to display the character è. The browser does the rendering when you view the content. You will need to convert it in your code.
You can use the System.Web.HttpUtility.HtmlDecode function:
Code:
' Remove the space to see the example, the forums automatically converted it if I take the space out
Dim s As String = "t& #233;st"
MessageBox.Show(System.Web.HttpUtility.HtmlDecode(s))
-
Jul 17th, 2008, 01:23 PM
#9
Thread Starter
Hyperactive Member
Re: [2005] Unicode variable
Thanks!
One thing: "HttpUtility is not a member of 'Web'"... It's member of?
Last edited by Ivenesco; Jul 17th, 2008 at 01:27 PM.
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
-
Jul 17th, 2008, 01:29 PM
#10
Re: [2005] Unicode variable
Make sure you add a reference to System.Web in your project.
-
Jul 17th, 2008, 01:31 PM
#11
Thread Starter
Hyperactive Member
Re: [2005] Unicode variable
Ouh, you right Thanks, again!
"Only two things are infinite; the universe and human stupidity, and I'm not sure about the former."
Albert Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|