<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ASCII &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/ascii/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Fri, 17 Feb 2017 16:02:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Do you still ASCII?</title>
		<link>https://blog.xojo.com/2017/02/17/do-you-still-ascii/</link>
		
		<dc:creator><![CDATA[Norman Palardy]]></dc:creator>
		<pubDate>Fri, 17 Feb 2017 07:00:30 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[ASCII]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2200</guid>

					<description><![CDATA[From time to time we get code that illustrates a problem a user is having when they rely on old-school ASCII. This problem can occur&#8230;]]></description>
										<content:encoded><![CDATA[<p>From time to time we get code that illustrates a problem a user is having when they rely on old-school ASCII. This problem can occur when using the Chr function to create a character.</p>
<p>One example we see reasonably frequently is code to create a string that contains a quote like:</p>
<pre> dim someString as String = chr(34) + "someValue" + chr(34)</pre>
<p>This style is not necessary and may give unwanted results if you have an unusual string encoding. Instead, you can write this without the use of the Chr function. Here&#8217;s how:</p>
<p><span id="more-2200"></span></p>
<p>Simply put 2 quotes inside the string value where you want one to appear like so:</p>
<pre> dim someString as String = """someValue"""</pre>
<p>Or create a constant, put one quote in the constant and write it like this:</p>
<pre> dim someString as String = kQuote + "someValue" + kQuote</pre>
<p>The other one we see  from time to time is very similar:</p>
<pre> // trying to use "extended ascii" from a list like http://www.asciitable.com
 dim someString as String = chr(179) + "someValue" + chr(179)
</pre>
<p>This one is subtly worse since Chr returns a valid ASCII character only for values &lt;= 127 and returns the character that is that code point for values &gt; 127. Since your string is actually UTF8, when you use chr(179) you get ³ (<a href="http://www.isthisthingon.org/unicode/index.phtml?glyph=00B3">a superscript 3</a>) and not the vertical bar you might have expected from the ASCII chart.</p>
<p>You can create a constant for the vertical bar symbol or you can use this code that references a specific <a href="http://documentation.xojo.com/api/text/encoding_text/textencoding.html">TextEncoding</a> where the vertical bar is 179:</p>
<pre> Dim verticalBar As String = Encodings.DOSLatin1.chr(179)</pre>
<p>So remember, ASCII is not as commonly used these days.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
