Showing posts with label characters. Show all posts
Showing posts with label characters. Show all posts

Thursday, March 29, 2012

Foreign characters in email

Hi,

My applications sends email using the smtp service.

When the service sends the mail, the content has some foreign characters in it.

These generally occur when I give forward the mail to someone or when the content has a fullstop.

I have given the subscriber's locale as en-us.

Below given is the first instance which i am facing.

Note: This is an auto-generated mail..Do not reply to this mail..

Above you can see, there are two dots instead of one.

Another instance is when I forward the mail:

?噉?扮灳??噉?剂???慬杮攽?獵挠慬獳伽瑵潬歯敍獳条?慥敤?污杩?氢晥??剉∽呌≒ ̄??慴楢摮硥∽???但呎?捡?吢?楓敺∽? ̄????匠??????? ̄?剂 ̄?吾??圠????匾??匠?????乏???????噉??噉Hi,

These are the characters i had mentioned above.


Are you setting the BodyEncoding element in the DeliveryChannel of the ICF? Something like:

<Argument>
<Name>BodyEncoding</Name>
<Value>utf-16</Value>
</Argument>

HTH...

Joe

|||yes it is utf-16

Regards,
navbhan|||Generally speaking, I've seen a number of programs that do not natively support UTF-16. Try UTF-8 and see what happens. If your application requires UTF-16, that may not be a long term solutions, but at least it may help to clarify the issues a bit.

HTH...

Joe

Foreign characters in email

Hi,

My applications sends email using the smtp service.

When the service sends the mail, the content has some foreign characters in it.

These generally occur when I give forward the mail to someone or when the content has a fullstop.

I have given the subscriber's locale as en-us.

Below given is the first instance which i am facing.

Note: This is an auto-generated mail..Do not reply to this mail..

Above you can see, there are two dots instead of one.

Another instance is when I forward the mail:

?噉?扮灳??噉?剂???慬杮攽?獵挠慬獳伽瑵潬歯敍獳条?慥敤?污杩?氢晥??剉∽呌≒ ̄??慴楢摮硥∽???但呎?捡?吢?楓敺∽? ̄????匠??????? ̄?剂 ̄?吾??圠????匾??匠?????乏???????噉??噉Hi,

These are the characters i had mentioned above.


Are you setting the BodyEncoding element in the DeliveryChannel of the ICF? Something like:

<Argument>
<Name>BodyEncoding</Name>
<Value>utf-16</Value>
</Argument>

HTH...

Joe

|||yes it is utf-16

Regards,
navbhan|||Generally speaking, I've seen a number of programs that do not natively support UTF-16. Try UTF-8 and see what happens. If your application requires UTF-16, that may not be a long term solutions, but at least it may help to clarify the issues a bit.

HTH...

Joe

foreign characters are not being imported into the table correctly

hello everyone,

i have few fields that contain foreign characters with diacritic marks which are not getting imported correctly.

below is the import format:

- File type: ASCII
- Row delimiter: carriage return and line feed {CR/LF}
- Column delimiter: Tab
- Text qualifier: None

Please advice.

Here is the errors i'm getting:

- Executing (Error)

Messages

Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column "Country_str_local_long_name" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)

Error 0xc020902a: Data Flow Task: The "output column "Country_str_local_long_name" (37)" failed because truncation occurred, and the truncation row disposition on "output column "Country_str_local_long_name" (37)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)

Error 0xc0202092: Data Flow Task: An error occurred while processing file "L:\Country.txt" on data row 6.
(SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task: The PrimeOutput method on component "Source - Country_txt" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "SourceThread0" has exited with error code 0xC0047038.
(SQL Server Import and Export Wizard)

Error 0xc0047039: Data Flow Task: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "WorkThread0" has exited with error code 0xC0047039.
(SQL Server Import and Export Wizard)

Hi,

Have you set the properties for the locale and the default code page?

If you're using a Flat File source, these properties are available in the Flat File Connection Manager Editor dialog box. You open this dialog box by double clicking the Flat File Source control, and then clicking New in the Flat File Source Editor dialog box.

sql

Monday, March 12, 2012

FOR XML RAW & Null Characters Bug

Just curious if anyone else has seen this issue:
We had a situation where the XML being retrieved from an XML Explicit query
was malformed. After looking at the resulting XML from the query being ran
with different sets of paramaters we were able to identify that the building
of the XML was stopping on the same value. Looking further we noticed this
field had a null character (ASCII code of 0).
Here's a simple example showing the issue:
declare @.var varchar(100)
set @.var='Josh' + CHAR(0)
select @.var AS Col
for XML RAW
this results in <row Col="Josh
I couldn't find if this was a documented bug or expected behavior? Does
anyone know of any articles that describe how the null character is handled
in SQL?
Thanks
JoshOn Mon, 30 Jan 2006 13:05:31 -0800, joshb wrote:

>Just curious if anyone else has seen this issue:
>We had a situation where the XML being retrieved from an XML Explicit query
>was malformed. After looking at the resulting XML from the query being ran
>with different sets of paramaters we were able to identify that the buildin
g
>of the XML was stopping on the same value. Looking further we noticed this
>field had a null character (ASCII code of 0).
>Here's a simple example showing the issue:
>declare @.var varchar(100)
>set @.var='Josh' + CHAR(0)
>select @.var AS Col
>for XML RAW
>this results in <row Col="Josh
>I couldn't find if this was a documented bug or expected behavior? Does
>anyone know of any articles that describe how the null character is handled
>in SQL?
Hi Josh,
The problem is that ASCII 0 is used as a string delimiter in many
languages. So the low-level code that sends the results to the screen
sees the ASCII 0 and thinks it's the end of the string.
Try running your code from another client (e.g. osql).
Hugo Kornelis, SQL Server MVP|||Hi, Josh
The problem is fixed in SQL Server 2005, where your example returns
this (in Management Studio or in Query Analyzer):
<row Col="Josh�"/>
However, Management Studio warns that the character with the code 0x0
is illegal in XML documents.
Razvan

Friday, March 9, 2012

for xml explicit data problem

Hi
I am running the following stored proc by executing a data set in c#.
surprisigly I am getting data padded with extra characters.
something like this - \"christy john"\. How to get rid of '\' this
character.
i try search and replace with regexp as well as string replace
functions without luck.
Here is the actual xml look like when I read from data set in c#.
<TREENODES><treenode text=\"A/L ALLANDOO, FELIX\"/><treenode
text=\"BEDI, RAHUL\"/><treenode text=\"CHALMERS, WILLIAM\"><treenode
text=\"CNOSSEN, RICK\"><treenode text=\"ANKALA, PRAVEEN\"/><treenode
text=\"BOGIA, DOUGLAS\"/><treenode text=\"COOK, HAROLD\"/><treenode
text=\"DAILY, STEPHEN\"/><treenode text=\"GAN, XIAOCHUN\"/><treenode
text=\"GARCEAU, PAUL\"/><treenode text=\"GOTTHARDT,
STEVEN\"/><treenode text=\"GUPTA, MEENAKSHI\"/></TREENODES>
Query analyser data in SQL SERVER looks perfectly alright without
special
character padding like shown beow.
<TREENODES><treenode text="A/L ALLANDOO, FELIX"/><treenode text="BEDI,
RAHUL"/><treenode text="CHALMERS, WILLIAM"><treenode text="CNOSSEN,
RICK"><treenode text="ANKALA, PRAVEEN"/><treenode text="BOGIA,
DOUGLAS"/><treenode text="COOK, HAROLD"/><treenode tex
Please help me.
Rao
-- Here is c# code --
ds = SqlHelper.ExecuteDataset(ConfigurationSettings.App Settings[ASPNET.StarterKit.TimeTracker.Web.Global. CfgKeyConnString],
SPname);
System.IO.StringWriter strWriter = new StringWriter();
ds.WriteXml(strWriter);
strXML = strWriter.ToString();
--Here is stored procedure and c# code--
dbo.ResourceXMLTest
as
set nocount on
--Take out the next block and make this SP accept
--a variable table like it does for @.EmpToMan
SET CONCAT_NULL_YIELDS_NULL OFF
Declare @.EmpToMan table(
ResourceID int,
ManagerID int,
Depth int,
Lineage nvarchar(256),
ResourceWWID numeric(19),
RFirstName nvarchar(50),
RLastName nvarchar(50)
)
INSERT INTO @.EmpToMan
SELECT
E.EmployeeID,
E.ManagerID,
E.Depth,
E.Lineage,
R.WWID,
R.FirstName ,
R.LastName + ', ' + R.FirstName
--R.LastName + ', ' + R.FirstName
FROM
Resources R left outer join EmployeeToManager E
ON r.resourceID = E.EmployeeID
select
1 as Tag,
0 as Parent,
null as [TREENODES!1!text],
null as [treenode!2!text],
null as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
union all
select
2 as Tag,
1 as Parent,
null,
RLastName as [treenode!2!text],
null as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
from
@.EmpToMan
where
Depth + 1 = 1
union
all
select
3 as Tag,
2 as Parent,
null,
t1.RLastName,
t2.RLastName as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
from
@.EmpToMan as t1
inner join
@.EmpToMan as t2
on
t1.ResourceID = t2.ManagerID
where
t1.depth + 1 = 1
and
t2.depth + 1 = 2
union
all
--Begin Block #4
select
4 as Tag,
3 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From
@.EmpToMan as t1
inner join
@.EmpToMan as t2
on
t1.ResourceID = t2.ManagerID
inner join
@.EmpToMan as t3
on
t2.ResourceID = t3.ManagerID
where
t1.depth +1 = 1
and
t2.depth + 1 = 2
and
t3.depth + 1 = 3
--End Block
union all
--Begin Block #5
select
5 as Tag,
4 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
--End Block
union all
--Begin Block #6
select
6 as Tag,
5 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
--End Block
union all
--Begin Block #7
select
7 as Tag,
6 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
--End Block
union all
--Begin Block #8
select
8 as Tag,
7 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
--End Block
union all
--Begin Block #9
select
9 as Tag,
8 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
--End Block
union all
--Begin Block #10
select
10 as Tag,
9 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
--End Block
union all
--Begin Block #11
select
11 as Tag,
10 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
--End Block
union all
--Begin Block #12
select
12 as Tag,
11 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
t11.RLastName as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
inner join @.EmpToMan as t11
on t10.ResourceID = t11.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
and t11.depth + 1 = 11
--End Block
union all
--Begin Block #13
select
13 as Tag,
12 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
t11.RLastName as [treenode!12!text],
t12.RLastName as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
inner join @.EmpToMan as t11
on t10.ResourceID = t11.ManagerID
inner join @.EmpToMan as t12
on t11.ResourceID = t12.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
and t11.depth + 1 = 11
and t12.depth + 1 = 12
--End Block
order by
[TREENODES!1!text],
[treenode!2!text],
[treenode!3!text],
[treenode!4!text],
[treenode!5!text],
[treenode!6!text],
[treenode!7!text],
[treenode!8!text],
[treenode!9!text],
[treenode!10!text],
[treenode!11!text],
[treenode!12!text],
[treenode!13!text]
for xml explicit
This looks like a C# issue. Are you sure that the \ is actually part of the
data? It could be that you see \" as a way to escape the " for some C#
specific reason and that the data still only contains ". You may want to
check in a C# specific newsgroup if that does not explain it.
HTH
Michael
"rao" <jayamallik@.hotmail.com> wrote in message
news:f2ff1cc.0408251644.2bf22b62@.posting.google.co m...
> Hi
> I am running the following stored proc by executing a data set in c#.
> surprisigly I am getting data padded with extra characters.
> something like this - \"christy john"\. How to get rid of '\' this
> character.
> i try search and replace with regexp as well as string replace
> functions without luck.
>
> Here is the actual xml look like when I read from data set in c#.
> <TREENODES><treenode text=\"A/L ALLANDOO, FELIX\"/><treenode
> text=\"BEDI, RAHUL\"/><treenode text=\"CHALMERS, WILLIAM\"><treenode
> text=\"CNOSSEN, RICK\"><treenode text=\"ANKALA, PRAVEEN\"/><treenode
> text=\"BOGIA, DOUGLAS\"/><treenode text=\"COOK, HAROLD\"/><treenode
> text=\"DAILY, STEPHEN\"/><treenode text=\"GAN, XIAOCHUN\"/><treenode
> text=\"GARCEAU, PAUL\"/><treenode text=\"GOTTHARDT,
> STEVEN\"/><treenode text=\"GUPTA, MEENAKSHI\"/></TREENODES>
>
> Query analyser data in SQL SERVER looks perfectly alright without
> special
> character padding like shown beow.
> <TREENODES><treenode text="A/L ALLANDOO, FELIX"/><treenode text="BEDI,
> RAHUL"/><treenode text="CHALMERS, WILLIAM"><treenode text="CNOSSEN,
> RICK"><treenode text="ANKALA, PRAVEEN"/><treenode text="BOGIA,
> DOUGLAS"/><treenode text="COOK, HAROLD"/><treenode tex
> Please help me.
> Rao
>
> -- Here is c# code --
> ds =
> SqlHelper.ExecuteDataset(ConfigurationSettings.App Settings[ASPNET.StarterKit.TimeTracker.Web.Global. CfgKeyConnString],
> SPname);
> System.IO.StringWriter strWriter = new StringWriter();
> ds.WriteXml(strWriter);
> strXML = strWriter.ToString();
> --Here is stored procedure and c# code--
> dbo.ResourceXMLTest
> as
> set nocount on
> --Take out the next block and make this SP accept
> --a variable table like it does for @.EmpToMan
> SET CONCAT_NULL_YIELDS_NULL OFF
> Declare @.EmpToMan table(
> ResourceID int,
> ManagerID int,
> Depth int,
> Lineage nvarchar(256),
> ResourceWWID numeric(19),
> RFirstName nvarchar(50),
> RLastName nvarchar(50)
> )
> INSERT INTO @.EmpToMan
> SELECT
> E.EmployeeID,
> E.ManagerID,
> E.Depth,
> E.Lineage,
> R.WWID,
> R.FirstName ,
> R.LastName + ', ' + R.FirstName
> --R.LastName + ', ' + R.FirstName
> FROM
> Resources R left outer join EmployeeToManager E
> ON r.resourceID = E.EmployeeID
> select
> 1 as Tag,
> 0 as Parent,
> null as [TREENODES!1!text],
> null as [treenode!2!text],
> null as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> union all
> select
> 2 as Tag,
> 1 as Parent,
> null,
> RLastName as [treenode!2!text],
> null as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> from
> @.EmpToMan
> where
> Depth + 1 = 1
> union
> all
> select
> 3 as Tag,
> 2 as Parent,
> null,
> t1.RLastName,
> t2.RLastName as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> from
> @.EmpToMan as t1
> inner join
> @.EmpToMan as t2
> on
> t1.ResourceID = t2.ManagerID
> where
> t1.depth + 1 = 1
> and
> t2.depth + 1 = 2
> union
> all
> --Begin Block #4
> select
> 4 as Tag,
> 3 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From
> @.EmpToMan as t1
> inner join
> @.EmpToMan as t2
> on
> t1.ResourceID = t2.ManagerID
> inner join
> @.EmpToMan as t3
> on
> t2.ResourceID = t3.ManagerID
> where
> t1.depth +1 = 1
> and
> t2.depth + 1 = 2
> and
> t3.depth + 1 = 3
> --End Block
> union all
> --Begin Block #5
> select
> 5 as Tag,
> 4 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> --End Block
> union all
> --Begin Block #6
> select
> 6 as Tag,
> 5 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> --End Block
> union all
> --Begin Block #7
> select
> 7 as Tag,
> 6 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> --End Block
> union all
> --Begin Block #8
> select
> 8 as Tag,
> 7 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> --End Block
> union all
> --Begin Block #9
> select
> 9 as Tag,
> 8 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> --End Block
> union all
>
> --Begin Block #10
> select
> 10 as Tag,
> 9 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> --End Block
> union all
> --Begin Block #11
> select
> 11 as Tag,
> 10 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> --End Block
> union all
> --Begin Block #12
> select
> 12 as Tag,
> 11 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> t11.RLastName as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> inner join @.EmpToMan as t11
> on t10.ResourceID = t11.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> and t11.depth + 1 = 11
> --End Block
> union all
> --Begin Block #13
> select
> 13 as Tag,
> 12 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> t11.RLastName as [treenode!12!text],
> t12.RLastName as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> inner join @.EmpToMan as t11
> on t10.ResourceID = t11.ManagerID
> inner join @.EmpToMan as t12
> on t11.ResourceID = t12.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> and t11.depth + 1 = 11
> and t12.depth + 1 = 12
> --End Block
> order by
> [TREENODES!1!text],
> [treenode!2!text],
> [treenode!3!text],
> [treenode!4!text],
> [treenode!5!text],
> [treenode!6!text],
> [treenode!7!text],
> [treenode!8!text],
> [treenode!9!text],
> [treenode!10!text],
> [treenode!11!text],
> [treenode!12!text],
> [treenode!13!text]
> for xml explicit
|||Hi Michael,
Yes it is esacape character actually shown like this "\" as part of
data,
The ascii value of it is 34. In the debugger it shows as '"'. I need
to find out how to replace '"'with " double quotes.
I was able to replace with single quotes and empty strings. I am
getting
syntax errors while replacing with double quote.
for example tempstr=Regex.Replace(tempstr,Convert.ToString('"' ),"")
would produce the result some thing like this - text=A/L ALLANDOO,
FELIX\
But I need the result as look like this - text="A/L ALLANDOO, FELIX"\
Looking for some help.
Thanks
Rao
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message news:<#HUyLPyiEHA.2140@.TK2MSFTNGP15.phx.gbl>...[vbcol=seagreen]
> This looks like a C# issue. Are you sure that the \ is actually part of the
> data? It could be that you see \" as a way to escape the " for some C#
> specific reason and that the data still only contains ". You may want to
> check in a C# specific newsgroup if that does not explain it.
> HTH
> Michael
> "rao" <jayamallik@.hotmail.com> wrote in message
> news:f2ff1cc.0408251644.2bf22b62@.posting.google.co m...