473,379 Members | 1,326 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,379 software developers and data experts.

Help on char or string var...but some unicode

Helo everyone!

I'm making some little app whitch will help me to get things automated,,,im
in the need very often to make some little changes to some files, and
something like this:

dim string1
dim string2
dim temp

temp=string1
string1=sting2
sting2=temp

now, my procedure is taking every file, open it, do some changes and save
it!
but i loos my characters. Im from Croatia (EU) and have some chars like
|Щ®ÆÈ|...how can i save in unicode file type.

my code is:
==============================

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Label4.Text = "" Then
MsgBox("izaberi putanju prvo")
Exit Sub
End If

If TextBox1.Text = "" Then
MsgBox("Unesi barem nesto u gornje polje!")
Exit Sub
End If

Dim putanja As String = StatusBar1.Text & "\"
Dim dirinfo As DirectoryInfo
Dim niz As Array
Dim dir As Array
Dim filinf As FileInfo
Dim a As Int16 = 0
Dim tee As String

dirinfo = New DirectoryInfo(putanja)
niz = dirinfo.GetFiles("*." & TextBox3.Text)
dir = dirinfo.GetDirectories()

For Each filinf In niz
temp_string.Text = " "
temp_string.Refresh()
Dim sr As StreamReader = New StreamReader(putanja & filinf.Name)
Label5.Text = filinf.Name
Label5.Refresh()
temp_string.Text = sr.ReadToEnd
sr.Close()
temp_string.SelectAll()
Dim index As Integer = temp_string.Text.IndexOf(TextBox1.Text)
While index >= 0
temp_string.Select(index, TextBox1.TextLength)
temp_string.SelectedText = TextBox2.Text
index = temp_string.Text.IndexOf(TextBox1.Text, index + 1)
a += 1
End While
If a > 1 Then
MsgBox("nadjena je rijec!")
End If
Label9.Text = a
tee = temp_string.Text

'temp_string.SaveFile(putanja & filinf.Name)

Dim sw As StreamWriter = New StreamWriter(putanja & filinf.Name)
sw.Write(tee)
sw.Flush()
sw.Close()

Next
End Sub

==============================

thanks in advance

-k.p.
Nov 21 '05 #1
4 1285
Gorostas,

When I saw it well, than you set the information intermidiate in a textbox.
When your file is in a code table, that the computer cannot handle, then
some unicodecharacters will be lost.

This is in the configurations of your computer advanced coutry settings.

http://www.geocities.com/Athens/Acad...ph/fontset.htm

I hope this helps,

Cor
Nov 21 '05 #2
"gorostas" <go*****************@hotmail.com> schrieb:
now, my procedure is taking every file, open it, do some changes and save
it!
but i loos my characters. Im from Croatia (EU) and have some chars like
|Щ®ÆÈ|...how can i save in unicode file type.
[...]
Dim sw As StreamWriter = New StreamWriter(putanja &
filinf.Name)


'... = New StreamWriter(..., System.Text.Encoding.Unicode)'. Maybe the
UTF-8 encoding is sufficient ('Encoding.UTF8').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Thanx Cor, but my computer is configured ok whit my language and other
country settings.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OW****************@tk2msftngp13.phx.gbl...
| Gorostas,
|
| When I saw it well, than you set the information intermidiate in a
textbox.
| When your file is in a code table, that the computer cannot handle, then
| some unicodecharacters will be lost.
|
| This is in the configurations of your computer advanced coutry settings.
|
| http://www.geocities.com/Athens/Acad...ph/fontset.htm
|
| I hope this helps,
|
| Cor
|
|
Nov 21 '05 #4
Thanx Herfried, and yes UTF-8 is sufficient for everyone.
I putted breakpoint in my app and see that is streamwriting in
UTF-8....

and i dont know why cant i see my characters??

im opening *.asp and *.aspx files. If that can help someone.
i tried to open some othet *.txt files whitch i saved whit 'notepad'
and everything goes well-....very confusing"!"!

thanks all
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
| "gorostas" <go*****************@hotmail.com> schrieb:
| > now, my procedure is taking every file, open it, do some changes and
save
| > it!
| > but i loos my characters. Im from Croatia (EU) and have some chars like
| > |Щ®ÆÈ|...how can i save in unicode file type.
| >[...]
| > Dim sw As StreamWriter = New StreamWriter(putanja &
| > filinf.Name)
|
| '... = New StreamWriter(..., System.Text.Encoding.Unicode)'. Maybe the
| UTF-8 encoding is sufficient ('Encoding.UTF8').
|
| --
| M S Herfried K. Wagner
| M V P <URL:http://dotnet.mvps.org/>
| V B <URL:http://classicvb.org/petition/>
|
Nov 21 '05 #5

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

Similar topics

17
by: VM | last post by:
In my Windows app, I'm running a batch process that's composed of a FOR loop that'll run 15,000 times (datatable row count), copy cthe data of each row -3 fields- to a struct, and send the strct to...
8
by: Duncan Winn | last post by:
I am new to VC++7. I am using a method GetPrivateProfileString that requires an LPTSTR. I have defined this as a: char * data_name; I am then trying to convert this to an LPOLESTR and I...
14
by: Nick Z. | last post by:
I have a file that I want to read a UTF-16 unicode string from. What is the easiest way to accomplish that? Thanks in advance, Nick Z.
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
4
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
40
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages,...
4
by: Robin Haswell | last post by:
Okay I'm getting really frustrated with Python's Unicode handling, I'm trying everything I can think of an I can't escape Unicode(En|De)codeError no matter what I try. Could someone explain to...
1
by: Simon Posnjak | last post by:
On Mon, May 5, 2008 at 4:16 PM, Jean-Paul Calderone <exarkun@divmod.comwrote: some_module.some_thing(the_string) function is a swig generated function from a C lib. The C lib function expects...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: 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...

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.