CSC/ECE 517 Fall 2018- Project E1846. OSS Project Navy: Character Issues: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 5: Line 5:
1. In the existing Expertiza setup, the database supports only UTF-8 characters. Hence, if a user enters a non UTF-8 character, the database throws an error. This further leads to loss of data while refreshing or going back to the input page as data wasn't saved in database, effectively leading to loss of entire review if there's even a single non UTF-8 character. We need to solve the problem by removing such unsupported characters.
1. In the existing Expertiza setup, the database supports only UTF-8 characters. Hence, if a user enters a non UTF-8 character, the database throws an error. This further leads to loss of data while refreshing or going back to the input page as data wasn't saved in database, effectively leading to loss of entire review if there's even a single non UTF-8 character. We need to solve the problem by removing such unsupported characters.


2. The existing expertiza stores the HTML formatting tags (Like <b> for bold) as a string. However, while rendering the string these tags are not escaped, resulting in no formatting. We need to solve the issue and display proper formatting.
2. The existing expertiza stores the HTML formatting tags (Like <nowiki><b></nowiki> for bold) as a string. However, while rendering the string these tags are not escaped, resulting in no formatting. We need to solve the issue and display proper formatting.


== Files Refactored ==
== Files Refactored ==

Revision as of 22:53, 2 November 2018

E1846. OSS Project Navy: Character Issues Fall 2018, CSC/ECE 517.

Problem Statement

1. In the existing Expertiza setup, the database supports only UTF-8 characters. Hence, if a user enters a non UTF-8 character, the database throws an error. This further leads to loss of data while refreshing or going back to the input page as data wasn't saved in database, effectively leading to loss of entire review if there's even a single non UTF-8 character. We need to solve the problem by removing such unsupported characters.

2. The existing expertiza stores the HTML formatting tags (Like <b> for bold) as a string. However, while rendering the string these tags are not escaped, resulting in no formatting. We need to solve the issue and display proper formatting.

Files Refactored

The following files were modified for this project namely:
1. application_controller
2. self_review_popup

Solution Approach

The following changes were made in the app/controllers/application_controller.rb file:-

1.We defined the following before_action: filter_ascii 2. The following methods were defined by us

  i.  filter_ascii
This method makes a recursive call to the remove_ascii method.
  ii. remove_ascii
This method is a recursive hashing function that checks the input params and then removes the Chinese non-UTF-8 comma or any such characters and then saves this value.
  iii. self.verify
This function is just as its name suggests to verify the valid input.

3. The above changes were also made to make the code follow ruby style and guidelines.

The following changes were made in the apps/views/popup/self_review_popup.html.erb file:-

1.Adding the functionality of ‘sanitize’ to specific html popups such as answer, comments and additional_comment which strips them of the html tags and thus ensures in the solution of our 2nd problem.

Testing Details

RSpec

We found no existing test cases for the above two problem statements. So we are to define test cases which generate the list of unwanted Chinese non-UTF8 characters and also HTML tags in the views and then refactor our code so that it automatically removes them without any failing of functionalities.

References

  1. Link to the videos to see the steps followed for testing and resolving the problems: [1]