Click here to Skip to main content
14,734,236 members
Articles » Languages » C# » General
Posted 12 Aug 2013


8 bookmarked

Reading Turkish RSS Feed in Console with Turkish Fonts

Rate me:
Please Sign up or sign in to vote.
4.50/5 (4 votes)
14 Aug 2013CPOL
This article has a usable software tool to read RSS feeds and it is especially designed to read and display Unicode characters inside a console window.


I wanted to read Turkish news inside a console devoid of all the pictures and flashy signs. Just text. I looked around and didn't find a tool that does this. This project puts together freely available code snippets for different parts of the project. If you downloaded the binary distribution, Please create a shortcut link of the exe file (MyCSrss.exeand change the font to LUCIDA CONSOLE to see the Unicode characters.

The Work Behind 

One of the surprising challenges was actually displaying Turkish Unicode fonts. The solution seems to be using the kernel32.dll API [1]. I move a set of functions into the Turkish.cs file, but all that's needed is one function:

Image 1

This function can display Unicode characters inside a console window as long as the font property of the console is set to TrueType font, such as Lucida Console font.  I added into Turkish.cs all the special Turkish characters that are not in the regular ASCII using the ISO 8859-9 to Unicode document[2] :

Small Letters

Capital Letters













The font property of the console is changed by right-clicking the top-left corner of the console window and selecting "Properties", and then the "Font" tab: 

Image 2

It is possible to add more fonts to the console as long as they are fixed-width fonts [3].  But Lucida is perfectly fine to display all of the Turkish letters:

Image 3

Code that created the above is:

Image 4

Reading RSS Feed 

Microsoft's System.Net[4] and System.Xml.Linq[5] are easy to use libraries to read an RSS XML page and parse, respectively.

I wrapped relevant static functions inside the RSS class, which is in the RSS.cs file.  RSS class has one public method:

Image 5

Where rss_sites is an array of strings that are URL addresses for the RSS feeds. It should be noted that when using an HttpWebRequest object, setting its Proxy to null makes it much faster[6].

Sometimes the "description" element in the RSS feed is cluttered with other XML elements I am not interested in. To strip away these StripTagsCharArray[7] function is used.

Putting It All Together 

I don't like the way the system automatically positions the console window. I adjusted the specifications to my liking by right-clicking on the top-left corner of the console window and selecting properties, and then selecting 'Layout':

Image 6

Running the app returns with a list of Turkish economic news from a Turkish newspaper[8].  This overwhelmed the console window, so I limited the output to 10 news line using a constant MAX_NEWS inside RSS.cs. If you press return enough many times you will then see CNN World News[9].

I tried to make program.cs as simple as possible: 

Image 7

What it returns is what I was hoping to find before I started working on it:

Image 8 

When I tried to test the release version of the exe in a clean environment, it quickly became evident how annoying it would be for the user to manually go and change the console properties.  How do you change the console font automatically? This question was asked and a worthy attempt was made to  answer it using undocumented kernel32 calls [11].  So I incorporated interesting function prototypes  into this project, but ultimately didn't use them because they didn't really do what I wanted. There is also a way to change the console's font using the registry, but I don't like this solution.

Earlier I had tried to use a shortcut link and change the font from there using the environment variable %CD%[10], but the shortcut property for the working directory wouldn't accept it. I tried scripting to a create [12] shortcut link but the API doesn't seem to support changing the font. That is why I couldn't include a shortcut link in this package.  If you wish to keep the Lucida font setting in your console, create a shortcut link and change the font to Lucida in its properties. Then each time you double click the shortcut, instead of the main MyCSrss.exe, you will see the Turkish fonts.



Aug. 9, 2013


Aug. 9, 2013


Aug. 10, 2013


Aug. 10, 2013


Aug. 10, 2013


Aug. 10, 2013


Aug. 9, 2013


Aug. 10, 2013


Aug. 10, 2013


Aug. 10, 2013


Aug.10, 2013



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Erol Esen
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

GeneralMissing images Pin
Roman Thaler12-Aug-13 4:33
MemberRoman Thaler12-Aug-13 4:33 
GeneralRe: Missing images Pin
Erol Esen12-Aug-13 5:00
MemberErol Esen12-Aug-13 5:00 
GeneralRe: Missing images Pin
Smitha Nishant12-Aug-13 7:02
protectorSmitha Nishant12-Aug-13 7:02 
GeneralRe: Missing images Pin
Erol Esen12-Aug-13 8:00
MemberErol Esen12-Aug-13 8:00 
GeneralRe: Missing images Pin
Smitha Nishant12-Aug-13 8:17
protectorSmitha Nishant12-Aug-13 8:17 
GeneralRe: Missing images Pin
Erol Esen13-Aug-13 5:11
MemberErol Esen13-Aug-13 5:11 
GeneralRe: Missing images Pin
Smitha Nishant13-Aug-13 10:19
protectorSmitha Nishant13-Aug-13 10:19 
GeneralRe: Missing images Pin
Erol Esen13-Aug-13 11:02
MemberErol Esen13-Aug-13 11:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.