Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Problems with twitter tutorials

Hi, we'll check.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Problems with twitter tutorials

Looks like there is no need to update existing code as app created with this tutorial works as expected.

Diego Esteban Osorio Zaldivia
Posts: 0
Joined: Thu Jul 25, 2013 10:18 pm

Problems with twitter tutorials

Yes, the application works fine, but only until you try to post a tweet with special characters * ) ( ! ... the code of serialization is incomplete :(

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problems with twitter tutorials

Hi Diego,

We'll check, thank you for reporting this.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problems with twitter tutorials

Hi Diego,

Please clarify, what symbols you can't post?
We can use the following symbols without any problem:
code{}[]|?., ) ( ! @#!$%^&()_+-/code

Diego Esteban Osorio Zaldivia
Posts: 0
Joined: Thu Jul 25, 2013 10:18 pm

Problems with twitter tutorials

Hi Katya!

I can't use the next symbols:
code * ! ) ( /code
I think that is because I did not include the following code in my application:

[quote:]//correct replacement instead of standard from jQuery.
// to force array serialization

Code: Select all

 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); 
} 

});

} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.

for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}

} else {
// Serialize scalar item.

add( prefix, obj );
}
}
[/quote]

But, it was not included in my application because following the tutorial I'm not clear where add it.

I leave a picture of error displayed here.

And here is the public link of my application.

Thanks for your comments,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problems with twitter tutorials

Diego,

Fixing will take some time...

Diego Esteban Osorio Zaldivia
Posts: 0
Joined: Thu Jul 25, 2013 10:18 pm

Problems with twitter tutorials

Ok, I will be attentive

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problems with twitter tutorials

Hi Diego,

Sorry, there is an incorrect piece of code in our tutorial. Replace this code:
precode//correct replacement instead of standard from jQuery.
// to force array serialization
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {// Serialize scalar item.
add( prefix, obj );
}
}/code/pre
with the following:precode//correct replacement instead of standard from jQuery.

jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = EncodeHelper.encodeSymbols( key ) + "=" + EncodeHelper.encodeSymbols( value );
};

&#47;&#47; Set traditional to true for jQuery <= 1&#46;3&#46;2 behavior&#46;
if ( traditional === undefined ) {
traditional = jQuery&#46;ajaxSettings && jQuery&#46;ajaxSettings&#46;traditional;
}

&#47;&#47; If an array was passed in, assume that it is an array of form elements&#46;
if ( jQuery&#46;isArray( a ) || ( a&#46;jquery && !jQuery&#46;isPlainObject( a ) ) ) {
&#47;&#47; Serialize the form elements
jQuery&#46;each( a, function() {
add( this&#46;name, this&#46;value );
});

} else {
&#47;&#47; If traditional, encode the "old" way (the way 1&#46;3&#46;2 or older
&#47;&#47; did it), otherwise encode params recursively&#46;
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}

&#47;&#47; Return the resulting serialization
return s&#46;join( "&" )&#46;replace( &#47;%20&#47;g, "+" );
};

function buildParams( prefix, obj, traditional, add ) {
var name;

if ( jQuery&#46;isArray( obj ) ) {
&#47;&#47; Serialize array item&#46;
jQuery&#46;each( obj, function( i, v ) {
if ( traditional || rbracket&#46;test( prefix ) ) {
&#47;&#47; Treat each array item as a scalar&#46;
add( prefix, v );

Code: Select all

} else { 
 &#47;&#47; If array item is non-scalar (array or object), encode its 
 &#47;&#47; numeric index to resolve deserialization ambiguity issues&#46; 
 &#47;&#47; Note that rack (as of 1&#46;0&#46;0) can't currently deserialize 
 &#47;&#47; nested arrays properly, and attempting to do so may cause 
 &#47;&#47; a server error&#46; Possible fixes are to modify rack's 
 &#47;&#47; deserialization algorithm or to provide an option or flag 
 &#47;&#47; to force array serialization to be shallow&#46; 
 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); 
} 

});

} else if ( !traditional && jQuery&#46;type( obj ) === "object" ) {
&#47;&#47; Serialize object item&#46;
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}

} else {
&#47;&#47; Serialize scalar item&#46;
add( prefix, obj );
}
}/code/pre

Return to “Issues”