---
title: "修正typo对中文标题文章支持的bug"
author: "dn365"
date: "2010-01-28T17:21:15Z"
tags: []
categories: ["编程语言"]
slug: "typo-bug"
draft: false
lastmod: "2010-01-28T17:21:15Z"
id: 582448
url: "https://dn365.iteye.com/blog/582448"
---

安装typo后，发现用中文标题发表文章，前台对应标题点开则将只能返回404页面，网上找到的方法：

原因在于RedirectController将已经URI.decode过的参数传给了Article.find\_by\_permalink方 法，该方法直接去查询articles表中:permalink列，所以失败。

 

修改方法很简单，只要修改${TYPO\_ROOT}/app/models/article.rb文件，将

`req_params[:permalink] = params[:title]`

修改为

`req_params[:permalink] = URI.encode(params[:title])`

 

 保存刷新，OK!