<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: NSDecimalNumber to NSXML and Back, A Cocoa Bug</title>
	<atom:link href="http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/</link>
	<description>Musings from an independent developer, Cocoa, Rails, and UI for the most part.</description>
	<pubDate>Wed, 07 Jan 2009 04:09:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mike Zornek</title>
		<link>http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-436</link>
		<dc:creator>Mike Zornek</dc:creator>
		<pubDate>Sun, 27 May 2007 01:37:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-436</guid>
		<description>&lt;p&gt;@Grahm: For future XML exports yes, but I need to process XML already out in the wild right now. Thanks for the note though.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Grahm: For future XML exports yes, but I need to process XML already out in the wild right now. Thanks for the note though.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Graham Dennis</title>
		<link>http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-435</link>
		<dc:creator>Graham Dennis</dc:creator>
		<pubDate>Sun, 27 May 2007 01:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-435</guid>
		<description>&lt;p&gt;If you're not trying to retain the decimal point, you may be better off writing the stringValue of the NSDecimalNumber instead of letting NSXMLNode encode it (incorrectly) for you. For NSDecimalNumbers like '90.0', this will turn them into '90', but you may or may not care about that.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you&#8217;re not trying to retain the decimal point, you may be better off writing the stringValue of the NSDecimalNumber instead of letting NSXMLNode encode it (incorrectly) for you. For NSDecimalNumbers like &#8216;90.0&#8217;, this will turn them into &#8216;90&#8217;, but you may or may not care about that.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Darkshadow</title>
		<link>http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-431</link>
		<dc:creator>Darkshadow</dc:creator>
		<pubDate>Sat, 26 May 2007 23:07:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.clickablebliss.com/2007/05/26/nsdecimalnumber-to-nsxml-and-back-a-cocoa-bug/#comment-431</guid>
		<description>&lt;p&gt;I have a little code change that will get things working, but it has a possible gotcha.  Since it's small, I'll just post the code here:&lt;/p&gt;

&lt;p&gt;Starting at line 53 in your AppController.m file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;NSDictionary *localeDictionary = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
i = 0;
e = [[self numbers] objectEnumerator];
while (nextObject = [e nextObject]) {
    numberElement = (NSXMLElement *)[NSXMLNode elementWithName:@"number"];
    numberAttribute = (NSXMLElement *)[NSXMLNode elementWithName:@"value"];
    [numberAttribute setObjectValue:[[[self objectInNumbersAtIndex:i] valueForKey:@"originalNumber"]
        descriptionWithLocale:localeDictionary]];
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;....&lt;/p&gt;

&lt;p&gt;The gotcha is that if the user happens to change their locale, this could give bad values (I haven't tested that, though).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have a little code change that will get things working, but it has a possible gotcha.  Since it&#8217;s small, I&#8217;ll just post the code here:</p>

<p>Starting at line 53 in your AppController.m file:</p>

<pre><code>NSDictionary *localeDictionary = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
i = 0;
e = [[self numbers] objectEnumerator];
while (nextObject = [e nextObject]) {
    numberElement = (NSXMLElement *)[NSXMLNode elementWithName:@"number"];
    numberAttribute = (NSXMLElement *)[NSXMLNode elementWithName:@"value"];
    [numberAttribute setObjectValue:[[[self objectInNumbersAtIndex:i] valueForKey:@"originalNumber"]
        descriptionWithLocale:localeDictionary]];
</code></pre>

<p>&#8230;.</p>

<p>The gotcha is that if the user happens to change their locale, this could give bad values (I haven&#8217;t tested that, though).</p>]]></content:encoded>
	</item>
</channel>
</rss>
