.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Conversion of text files from ANSI to UTF-8

Posted By: Syed Shakeer Hussain     Posted Date: July 15, 2010    Points: 2   Category :C#
reading and writing text files in ANSI format and
writing html-files in Charset ISO-8859-1 (Western Europe).

View Complete Post

More Related Resource Links

Document Conversion of large files



My MOSS 2007 environment fires OutOfMemory exceptions when attempt to launch a custom Document Converter on files larger then 50 MB (Video files) . Because my Document Converter is implemented by a standalone executable, I'm figuring these exceptions are fired by Sharepoint Work process, on downloading/uploading from/to temp folder, not by my custom converter.

If this is the case, can I apply any workarounds on server configuration ? I tried with /3GB switch without luck. Maybe SP1 will address this issue too ?



Import Multiple Text Files

I have 150 data delimited text files that need to be imported to a text file. Each of them is named for the table for which they contain data e.g. address.txt contains data that needs to imported to the address table. So what I have done is create a SSIS package that contains a ForEach loop that iterates through the the files, and has a Load Data field object. What I haven't been able to figure out is what logic needs to be added for the Data Flow. I know I will need a Flat File Source with a connection source that is tied to file it is processing.  However, after all of that I am not sure what do because each text file contains a different table with different columns. Can someone explain to me how to handle this? Thanks, Isaiah 

Searching plain-text files.

Hello, I was wondering if you guys could point me in the right direction toward implementing a page in my Web Form application that would be able to allow a user to search a text file which originally exists on a Window File share. Once the user searches for their text, I'd like the page to be split into two panes: One on the left that lists all the hits, each listing being a link which contains an excerpt of text around the link. And another pane on the right which shows the full text document with all the hits highlighted.Now, should I be loading the text file into a data base and be using something like Lucence .NET to search? Or is there a library of controls that can do all this for me already?By searching around the internet I've found bits and pieces of solutions to this problem, such as how to highlight result hits: http://www.knowdotnet.com/articles/highlightingsearchtext.htmlAnd how to perform database searches: http://www.asp.net/sql-server/videos/enabling-full-text-search-in-your-text-dataAm I going to have to painstakingly glue all these things together and write my own solution to this?Thanks for the help in advance.

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

Problem importing text files with binary zeros (0x00) via SSIS(SQL2005). It is all fine when using D

Hi.   There is a "text" file generated by mainframe and it has to be uploaded to SQL Server. I've reproduced the situation with smaller sample. Let the file look like following: A17     123.17  first row          BB29    493.19  second             ZZ3     18947.1 third row is longer And in hex format: 00:  41 31 37 20 20 20 20 20 ? 31 32 33 2E 31 37 20 20  A17     123.17  10:  66 69 72 73 74 20 72 6F ? 77 0D 0A 42 42 32 39 20  first row??BB29 20:  20 00 20 34 39 33 2E 31 ? 39 20 20 73 65 63 6F 6E     493.19  secon30:  64 0D 0A 5A 5A 33 20 20 ? 20 20 20 31 38 39 34 37  d??ZZ3     1894740:  2E 31 20 74 68 69 72 64 ? 20 72 6F 77 00 69 73 20  .1 third row is 50:  6C 6F 6E 67 65 72       ?                          longer          I wrote "text" in quotes because sctrictly it is not pure text file - non-text binary zeros (0x00) happen sometimes instead of spaces (0x20).   The table is: CREATE TABLE eng ( src varchar (512) )   When i upload this file into SQL2000 using DTS or Import wizard, the table contains: select src, substring(src,9,8), len(src) from eng <               src                ><substr>             <len> A17     123.17  first row           123.17                  25BB29                                493.19                  22ZZ3     18947.1 third row           18947.1                 35   As one can see, everything was importe

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

Hiding Command Promp window during ffmpeg conversion of video files

hi Can any body tell me how to  Hide Command Promp window during ffmpeg conversion of video files which comes up when we select a file to be converted.I want to hide the window because it comes in between the running project i want it to execute the files without showing that window to user regardsHArry 

Can't full text search pdf files


I have a MyDocuments table that has the following columns: ID, Document varchar(max), and DocumentType

I'm only able to get HTML and TXT results from my full text search queries -- but I know that I should be getting PDFs as well.

What am I doing wrong?

FYI: I did install the iFilter.

Can PackageStart and PackageEnd events be disabled when logging to text files


Hi All,

I have a package which runs periodically. I have setup the logging to log only OnError events, but everytime the package runs it registers a "Beginning of package execution" and "End of package execution" line in the log file.

As a result of this the log file grows in size and is difficult to open and analyze in the case of an actual error.

Is there a way i can prevent these events from logging into the text file.

text files



  I have 10 .txt files in my folder.I want pull the data into sql table.

my requirement is


1) text1--->pull into sql table A(here Meta data is same)

2)text2---->pull into  Sql table B(here also meta dat same)




like this


plz let me know


how can i develop package

The conversion returned status value 4 and status text "Text was truncated or one or morecharacters


[Datatype Conversion  Name [69]] Error: Data conversion failed while converting column
"TaskDescription" (35) to column "C_TaskDescription" (276).
 The conversion returned status value 4 and status text "Text was truncated or one or morecharacters had no match in the target code page.".

The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020

This is working fine in VS2005.  Above both errors Only after upgradation of the package  to 2008.



How to move the SQL Server SQLFT log files created by the full text catalog process.


I need to move the location of the SQLFT text log files from it's current location %ProgramFiles%\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\LOG folder to another larger drive to accomodate the log file growth.  I cannot find anything on how to make this change.  Does anyone have an answer?  I have found this is a default at install - but during install did not find how to change this. 

Thank you.



Conversion of xlsx files uploaded to document library


I have a MS Sharepoint Server 2007 installed, and we are using a document library to store files of various types.  Some of our users use OpenOffice to read and save these documents.

When I upload a document that is an xlsx formatted document, microsoft seems to convert the file into a different format than the file that was uploaded - preventing Open Office from opening the file.  The file is still an xlsx file and Microsoft Excel is able to understand this format.  Is there a way to turn this behaviour off?

I've tried turning off the Document Conversions Launcher Service (as well as the Load Balancer)

I've also tried changing the settings for the document library -> 'Open in client application' and 'open as web page', neither of these seem to solve my problem. 


How can I configure Sharepoint so that it doesn't convert my xlsx files?  Any clues would be greatly appreciated.

Clean Web.Config Files (VS 2010 and .NET 4.0 Series)

.NET 4 includes a new version of the CLR, and a new .NET 4 specific machine.config file (which is installed side-by-side with the one used by .NET 2, .NET 3 and .NET 3.5).

The new .NET 4 machine.config file now automatically registers all of the ASP.NET tag sections, handlers and modules that we've added over the years, including the functionality for:

.ASP.NET Dynamic Data
.ASP.NET Routing (which can now be used for both ASP.NET WebForms and ASP.NET MVC)
.ASP.NET Chart Control (which now ships built-into ASP.NET V4)
What this means is that when you create a new "Empty ASP.NET application" project in VS 2010, you'll find that the new default application-level web.config file is now clean and simple:

AutoCompleteStringCollection for text box in DataGridView 2.0

I have been searching for a way to have autocomplete in a DataGridTextBox
object. There does not appear to be an obvious way to do this like you would
for a TextBox outside of a grid using the AutoCompleteCustomSource. Any
thoughts on how I can add this collection? :)

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

SharePoint document migration challenges when migrating files and folders

There are several challenges when migrating documents to Microsoft SharePoint. While these challenges can be overcome, they are a real pain if the migration source, content and file systems are not SharePoint friendly.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend