Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle special characters with SSIS?

Status
Not open for further replies.

ton12

Programmer
Mar 9, 2005
58
0
0
GB
I need to replace all column delimiters in a
flat file by "|".

I need to replace all "é" by "|".

If the delimiter is any character to be replaced
by "|", there is no problem, it works fine.
But with special characters I have an error message
concerning the Substring clause as it cannot cope
with special characters

I have written a script task to do the replacing.

Any help would be appreciated.

Regards.
Ton

 
You need to refer to it by its' unicode value.

Try something like this:

Code:
myString.Replace(ChrW(233), "|")

Hope it helps,

Alex

[small]----signature below----[/small]
I'm pushing an elephant up the stairs

My Crummy Web Page
 
Thanks.

I'm writing the info to a file.

I have no error message but it is not replacing
the "é" by '|'. Instead, it is being replaced
by a special character (a square).

Any suggestions?

Ton
 
Hi,

here is part of the code :
-----------------------------------------------
Line = TextLine.Replace(Delimiter1, Delimiter2)
ind = Line.ToString.LastIndexOf(Delimiter2)
----------------------------------------------

Delimiter1 - é
Delimiter2 - |

line is "11111é2222222é333"

Thru debugger, line is seen as

"11111?2222222?333"

When I write it to another file, the
line is as follows :

"11111?2222222?333"

I'm expecting : "11111|2222222|333"

Thanks for your input.
Ton




 
Can you please post a meaningful part of your code? For example where Delimiter1 and Delimiter2 are set?

Also, what is the input and output file types?

It's hard to tell what is going on without having the whole story.

[small]----signature below----[/small]
Majority rule don't work in mental institutions

My Crummy Web Page
 
Hi,

Here is part of the code :


Dim Delimiter1 As String
Dim Delimiter2 As String
Dim TextLength As Integer
Dim TextLine As String
Dim Line As String

Dim fs As New FileStream(FileName, FileMode.Open, FileAccess.Read)
Dim sr As New StreamReader(fs)

Delimiter1 = Dts.Variables("InDelimiter").Value.ToString
Delimiter2 = Dts.Variables("OutDelimiter").Value.ToString

Do While sr.Peek() <> -1

Line = TextLine.Replace(Delimiter1, Delimiter2)

objWriter.Write(Line)
Loop


Thanks in advance for your feedback
 
What are the data types of the Variables you are using?

Take a look at this when you get a chance, I think it will help you to ask more complete questions: faq222-2244



[small]----signature below----[/small]
Majority rule don't work in mental institutions

My Crummy Web Page
 
The data types of the variables are defined as 'String'

 
Can you just post the whole code please? You aren't posting big enough pieces to really even get an idea of what you are trying to do. I think I see a few problems though.

[small]----signature below----[/small]
Majority rule don't work in mental institutions

My Crummy Web Page
 
By the way, click the "process TGML" link below posting box before you post the code so you can learn to format it as I did above.

[small]----signature below----[/small]
Majority rule don't work in mental institutions

My Crummy Web Page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top