More digging done.

After reading this post, http://tinyurl.com/3zhjf8, I'm more confused
so I'm going to try and write down what is happening and solve it
here.

The content that you send with the POST request should be the <entry>
element you created above, using the application/atom+xml content
type, that's from the horses mouth

http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingSingle

The character set encoding defaults to utf-8, so there's no need to
specify that in my header.

Here's my header code

@headers = {'Authorization' => "AuthSubtoken=\"#{authsub_token}\"",
'Content-Type'  => 'application/atom+xml'}

Kyle mentions in that post this

For data in the API, you should not HTML encode the input data unless
the "type" attribute of the title and content is "html".

Now in my case, and in everyone's case if you follow googles
instructions, posting a new event requires 'application/atom+xml', so
my encoding should not be happening, let's remove the html encoding
and see what happens.

Now it goes bang

Unrecognized element &#39;a&#39;, which is our butty single quote.

Now there's mention of this in that post

- Because you are generating XML, you need to _XML escape_ characters
that
have special meaning in XML documents.    Here's the characters to
look out
for and the encoded equivalents:

    less than (<)   : &lt;
    greater than (>) : &gt;
    ampersand (&) : &amp;
    apostrophe (') : &apos;
    quotation  (") : &quot;

The creation of my new content now looks like this

  content = row["body"].to_s
            content = content.gsub("<", "&lt;")
            content = content.gsub(">", "&gt;")
            content = content.gsub("&", "&amp;")
            content = content.gsub("'", "&apos;")
            content = content.gsub("\"", "&quote;")

wehey, my data goes through ok.  But hang on, there's elements I can
see in my google calendar that are showing as question marks?  What
could those be?  Well well, they are in fact stupid MS single quotes,
so let's try replacing them too.

            content = content.gsub("‘", "&apos;")
            content = content.gsub("’", "&apos;")

The ticks in the two lines above are the microsoft word ticks, they
might not display as such.

That didn't work, let's try removing them completely
            content = content.gsub("‘", "")
            content = content.gsub("’", "")

That didn't work either, I'm outputting my content variable into my
terminal window, that is set to show utf8, and it isn't finding those
special MS Word characters, hence not replacing them.

Let's try finding them using the UTF8 Byte translation of what they
are.

nope, can't find them using this either

            content = content.gsub("\342\200\230", "&rsquo;")
            content = content.gsub("\342\200\231", "&rsquo;")

Can anyone help me here, it's about to drive me nuts.














--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to