Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHadi Farhat
Courses Plus Student 7,102 Pointsmy form handles white spaces normally
I submitted a form with white spaces both in the title and content. There was no error messages and I did not use the URI.escape
method. Maybe I use a new version of sinatra that handles this problem automatically ?
4 Answers
Jay McGavren
Treehouse TeacherAre you passing a path with spaces in it to redirect
? That's when errors are likely to occur.
Lloyd Stevens
10,934 PointsMine also accepts spaces. When submitting the data it removes the spaces accordingly with %20 This works if there are also a number of words
I imagine this is an update in the sinatra that has fixed the issue with redirect and whitespace?
Zack Guo
12,135 PointsMe too! My form also handles white spaces normally without URI.escape.
Ahmed Mohamed Fouad
11,735 Pointsthe same here, my form handles white spaces normally
Thomas Lee
6,002 PointsThomas Lee
6,002 PointsI learned a lot from this course. Thanks, Jay! Thankfully, my browser also handles spaces as other users mention in this forum.
However, I noticed that when saving a new page with a title that includes a "?", a new .txt file will be created, as will the page, but it will not correctly request the resource. I know question marks are used in urls to designate the beginning of a query. Any way to escape question marks to preserve the title?
Jay McGavren
Treehouse TeacherJay McGavren
Treehouse TeacherYou might do a web search for the Ruby
URI::Escape
module; that should help.Also note that question marks are often a reserved character in the file names for many operating systems. Storing part of our data as a file name is a nice, simple example, but this is one of its inherent weaknesses. You might want to do a web search for Ruby's
Pstore
orYAML::Store
libraries as a way to store data without character set limitations.