Saturday 5 December 2015

Non Printable Character Error System Number 1072896760


You may comes across a situation where a application is throwing this error message.


System Number: 1072896760 
Code: 1072896760 
Description:Unknown error. 
Source:Microsoft OLEDB Persistence Provider 


It may not be immediately apparent what the cause of this error is or where to start looking as
its not descriptive to know a place to start. So one technique to check the origin of the error is the database records being pushed to the application.  
This application is built on .Net with a SQL Server back end.

During the troubleshooting phase it was observed the error did not occur with one set of records, though when tested with a different set of records the application would throw the error.

This required some further analysis of the records triggering the error. At first glance the records did not show anything unusual. It is of data type Varchar (100). The characters in the field looked normal with no indication how a Varchar record could cause an application to break.

It was decided to look at the record from a different perspective. Instead look if there was something in the data that could not be viewed normally. I wrote this script to highlight if there was an Ascii value in the record that could not be visible.

Below is this script that highlights any data outside of the normal Ascii range for printable characters.


CREATE TABLE TEST ( COL1 VARCHAR(100));
GO
INSERT INTO TEST VALUES('THIS IS A NONPRINTABLE CHARACTER STRING');

GO
DECLARE @pos int, @string char(100);
SET @pos = 1;
SELECT @string = COL1 FROM TEST
WHILE @pos <= DATALENGTH(@string)
BEGIN
IF ASCII(SUBSTRING(@string, @pos, 1)) <= 31
SELECT ASCII(SUBSTRING(@string, @pos, 1)) , 'NON PRINTABLE CHARACTER FOUND '
ELSE
SELECT ASCII(SUBSTRING(@string, @pos, 1)) , CHAR(ASCII(SUBSTRING(@string, @pos, 1)))

SET @pos = @pos + 1
END;

GO


In this example it was identified that it was a Non Printable Character causing the Web Application to fail.
The application was trying to handle a record from Sql Server that had the Non Printable Character Record Separator RS.
The web application was unable to handle this unexpected data, which caused it to fail and throw the above error message.

To manually generate this Non printable Character you would select the following on your keyboard.
Ctrl  Shift  ^
You can see this symbol represented in text editor NotePad++ as shown below.

(This text below has an Record Separator RS embedded in it).
'EXAMPLE TESTING OF NON PRINTABLE CHARACTER'



This issue was simply resolved at source by manually editing the record, deleting it and entering the data again, removing the unwanted character.

No comments:

Post a Comment