Swift 3将字符串从isoLatin1转换为utf8
我需要将ISO-8859-1(isoLatin1)编码的XML字符串转换为UTF-8。我尝试了一些我在其他问题上找到的代码,但其中大部分都包含将字符串转换为utf8,反之亦然。我没有任何代码,所以没有人会发布。Swift 3将字符串从isoLatin1转换为utf8
对不起,要清楚,我想:
String(data:isoLatin1EncodedData, encoding: .uf8)
是nil
String(data:isoLatin1EncodedData, encoding: .isoLatin1)
返回字符串的错误编码。
String(utf8String: isoLatin1EncodedString.cString(using: String.Encoding.isoLatin1)!)
是nil
我需要从一个编码转换为另一种... EDIT2字符串:样品饲料 - http://feeds.folha.uol.com.br/colunas/monicabergamo/rss091.xml
不知道这是你在找什么:
代码:
let inputString = String("Não tenho ai-ai-ai, ui-ui-ui")
if let data = inputString.data(using: .isoLatin1),
let convertedString = String(data: data, encoding: .isoLatin1) {
print("convertedString = \(convertedString)")
}
else {
print("Something went wrong in conversion")
}
输出:
convertedString = Não tenho ai-ai-ai, ui-ui-ui
你的url返回的字符串是isoLatin1。您可以在游乐场试试这个和自己验证:
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
let url = URL(string:"http://feeds.folha.uol.com.br/colunas/monicabergamo/rss091.xml")!
URLSession.shared.dataTask(with: url) { data, response, error in
print(data ?? "") // "16646 bytes\n"
guard let data = data else {
print(error ?? "none")
return
}
if let attStr = try? NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.isoLatin1.rawValue], documentAttributes: nil) {
print(attStr.string) // "http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/ Primeiro jornal em tempo real em língua portuguesa pt-br Copyright Folha de S.Paulo. Todos os direitos reservados. http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/folha/conheca/arquivo_e_copyright.shtml [email protected] (Webmaster Folha de S.Paulo) colunas/monicabergamo/ http://f.i.uol.com.br/folha/furniture/5.2/images/lgo-folha_de_spaulo-167x31.gif http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/ 88 31 Primeiro jornal em tempo real em língua portuguesa http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1919007-nao-tenho-ai-ai-ai-ui-ui-ui-diz-tony-ramos-sobre-proximidade-dos-70.shtml <b>Tony Ramos</b> conta que sua reação à <a href="http://www1.folha.uol.com.br/poder/2017/09/1917256-joesley-batista-e-ricardo-saud-se-apresentam-a-pf-em-sao-paulo.shtml">prisão</a> do empresário Joesley Batista, da JBS, no domingo (10), foi "como a de qualquer brasileiro. Primeiro, um susto. Depois, você fica triste. E então espera que a Justiça faça o seu serviço". <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1919007-nao-tenho-ai-ai-ai-ui-ui-ui-diz-tony-ramos-sobre-proximidade-dos-70.shtml">Leia mais</a> (09/17/2017 - 02h00) 17 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1919022-prefeitura-autoriza-instalacao-de-bandeiras-do-brasil-nas-marginais.shtml O advogado José Marcelo Braga Nascimento, que encabeça a campanha "Embandeirando São Paulo", recebeu autorização da prefeitura para instalar mastros com a bandeira nacional em 26 pontes das marginais Tietê e Pinheiros. Ele já tinha conseguido instalar outras iguais na avenida Brasil. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1919022-prefeitura-autoriza-instalacao-de-bandeiras-do-brasil-nas-marginais.shtml">Leia mais</a> (09/16/2017 - 02h00) 16 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918981-miller-e-acionado-na-justica-sobre-caso-que-envolve-o-mpf-e-a-embraer.shtml O <a href="http://www1.folha.uol.com.br/poder/2017/09/1918114-pf-encontra-mensagens-de-miller-e-aponta-ligacao-com-gabinete-de-janot.shtml">ex-procurador Marcello Miller</a> está sendo questionado, na Justiça, por sua atuação em outro caso rumoroso: a assinatura, em 2016, de um termo de ajustamento de conduta entre o Ministério Público Federal, que ele representava, e a Embraer. Um ex-diretor da empresa o acusa de atuação indevida no processo. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918981-miller-e-acionado-na-justica-sobre-caso-que-envolve-o-mpf-e-a-embraer.shtml">Leia mais</a> (09/16/2017 - 02h00) 16 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918965-janaina-paschoal-fica-em-ultimo-lugar-em-concurso-para-professor-titular-da-usp.shtml A advogada Janaína Paschoal foi a última colocada em um concurso que escolheu os dois novos professores titulares de direito penal da Faculdade de Direito da Universidade de São Paulo. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918965-janaina-paschoal-fica-em-ultimo-lugar-em-concurso-para-professor-titular-da-usp.shtml">Leia mais</a> (09/15/2017 - 20h09) 15 Sep 2017 20:09:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918588-vereadores-de-sp-pedem-que-mpf-investigue-mostra-cancelada.shtml A bancada cristã da Câmara Municipal de SP fez um requerimento que pede que o Ministério Público Federal apure "ilícitos penais" e "atos de improbidade administrativa" por parte do Ministério da Cultura, de executivos do Santander e do curador da <a href="http://www1.folha.uol.com.br/ilustrada/2017/09/1917600-curador-de-mostra-cancelada-diz-que-banco-infringiu-regras-basicas.shtml">mostra "Queermuseu"</a>. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918588-vereadores-de-sp-pedem-que-mpf-investigue-mostra-cancelada.shtml">Leia mais</a> (09/15/2017 - 02h00) 15 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918438-reacao-do-mercado-enfraquece-tese-de-que-jf-quebrara-sem-wesley-e-joesley.shtml A reação positiva do mercado em relação à troca de comando na J&F enfraquece o principal argumento de <a href="http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918087-joesley-batista-desconfia-que-pode-ser-traido-por-ricardo-saud.shtml">Joesley Batista</a> para conseguir o perdão judicial: sem ele e sem o <a href="http://www1.folha.uol.com.br/poder/2017/09/1918304-eu-me-vi-em-panico-disse-wesley-batista-em-audiencia-apos-ser-preso.shtml">irmão Wesley</a> à frente da empresa, ela poderia quebrar. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918438-reacao-do-mercado-enfraquece-tese-de-que-jf-quebrara-sem-wesley-e-joesley.shtml">Leia mais</a> (09/15/2017 - 02h00) 15 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918459-preparador-nuno-cobra-deixara-prisao.shtml O preparador físico Nuno Cobra deve deixar a carceragem da Polícia Federal de São Paulo, onde está preso desde a <a href="http://www1.folha.uol.com.br/cotidiano/2017/09/1917460-preparador-fisico-nuno-cobra-e-preso-por-crime-sexual-em-voo.shtml">segunda (11)</a>, nas próximas horas. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918459-preparador-nuno-cobra-deixara-prisao.shtml">Leia mais</a> (09/14/2017 - 16h51) 14 Sep 2017 16:51:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918386-morre-em-sp-o-jornalista-fernando-pacheco-jordao-autor-de-dossie-herzog.shtml O jornalista Fernando Pacheco Jordão morreu nesta quinta (14), em São Paulo, aos 80 anos. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918386-morre-em-sp-o-jornalista-fernando-pacheco-jordao-autor-de-dossie-herzog.shtml">Leia mais</a> (09/14/2017 - 12h03) 14 Sep 2017 12:03:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918236-ex-presidente-da-eletronuclear-preso-em-2015-opera-cancer-de-pele.shtml O ex-presidente da Eletronuclear Othon Luiz Pinheiro da Silva foi operado na quarta (13) de um câncer de pele, no hospital da Marinha no Rio de Janeiro. Aos 78 anos e condenado a 43 anos de prisão, o vice-almirante, considerado o pai do programa nuclear brasileiro, está <a href="http://www1.folha.uol.com.br/poder/2015/08/1665550-juiz-da-lava-jato-decreta-prisao-preventiva-de-almirante-e-executivo.shtml">detido</a> em uma unidade militar desde julho de 2015. Em janeiro, ele tentou o suicídio. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918236-ex-presidente-da-eletronuclear-preso-em-2015-opera-cancer-de-pele.shtml">Leia mais</a> (09/14/2017 - 02h00) 14 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918087-joesley-batista-desconfia-que-pode-ser-traido-por-ricardo-saud.shtml O clima entre os delatores da J&F é de desconfiança. Joesley Batista e seu irmão, Wesley, acreditam que o executivo Ricardo Saud pode traí-los caso a <a href="http://www1.folha.uol.com.br/poder/2017/09/1917324-definicao-sobre-futuro-da-delacao-da-jbs-pode-ficar-com-raquel-dodge.shtml">negociação</a> com o Ministério Público Federal para preservar benefícios que obtiveram no acordo de delação premiada naufrague. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1918087-joesley-batista-desconfia-que-pode-ser-traido-por-ricardo-saud.shtml">Leia mais</a> (09/14/2017 - 02h00) 14 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917896-luiza-brunet-e-ex-se-cumprimentam-mas-audiencia-de-conciliacao-fracassa.shtml A atriz Luiza Brunet se reencontrou com o ex, Lírio Parisotto, na segunda (11), na 4ª Vara da Família e Sucessões. Os dois se cumprimentaram de forma polida - mas a audiência de conciliação entre eles foi um fracasso. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917896-luiza-brunet-e-ex-se-cumprimentam-mas-audiencia-de-conciliacao-fracassa.shtml">Leia mais</a> (09/13/2017 - 02h00) 13 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917891-para-criminalistas-82888288saida-para-joesley-pode-ser-anular-processo-de-delacao.shtml A defesa dos delatores da J&F tem pouca esperança de manter a delação deles integralmente em pé. Se a repactuação dos benefícios com a PGR (Procuradoria-Geral da República) não evoluir a contento, a saída para <a href="http://www1.folha.uol.com.br/poder/2017/09/1917396-joesley-deixa-carceragem-da-pf-em-sp-e-segue-para-brasilia.shtml">Joesley Batista e Ricardo Saud,</a> entendem advogados criminalistas, seria partir para o tudo ou nada e tentar anular todo o processo. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917891-para-criminalistas-82888288saida-para-joesley-pode-ser-anular-processo-de-delacao.shtml">Leia mais</a> (09/13/2017 - 02h00) 13 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917885-rodrigo-maia-diz-que-nao-vai-ser-facil-negociar-a-reforma-da-previdencia.shtml O presidente da Câmara dos Deputados, Rodrigo Maia (DEM-RJ), afirma que só depois da passagem do "furacão" que deve ser a votação da segunda denúncia contra Michel Temer será possível negociar com as lideranças no parlamento se a reforma da Previdência será ou não votada. Mesmo assim, as tratativas não serão nada fáceis. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917885-rodrigo-maia-diz-que-nao-vai-ser-facil-negociar-a-reforma-da-previdencia.shtml">Leia mais</a> (09/13/2017 - 02h00) 13 Sep 2017 02:00:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917677-fhc-e-cardozo-serao-testemunhas-de-defesa-de-lula-nesta-terca-feira-em-sp.shtml O ex-presidente Fernando Henrique Cardoso será mais uma vez testemunha de defesa de Lula em um processo. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917677-fhc-e-cardozo-serao-testemunhas-de-defesa-de-lula-nesta-terca-feira-em-sp.shtml">Leia mais</a> (09/12/2017 - 07h10) 12 Sep 2017 07:10:00 -0300 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917580-joao-carlos-martins-viajara-pelo-brasil-para-formar-orquestras.shtml <b>PARTITURA</b><br/> A Fundação Bachiana Filarmônica, do maestro João Carlos Martins, teve seu plano de atividades de 2018 aprovado na Lei Rouanet. Estão previstos 28 concertos durante o ano, 22 deles gratuitos, além de cursos de música para jovens e crianças. O total do incentivo é de R$ 4,3 milhões. <a href="http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/*http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1917580-joao-carlos-martins-viajara-pelo-brasil-para-formar-orquestras.shtml">Leia mais</a> (09/12/2017 - 02h00) 12 Sep 2017 02:00:00 -0300 \n"
}
}.resume()
正如我说你的字符串将始终是Unicode(UTF-8),但你可以将数据转换成任何编码。例如:
let url = URL(string:"http://feeds.folha.uol.com.br/colunas/monicabergamo/rss091.xml")!
URLSession.shared.dataTask(with: url) { data, response, error in
print(data ?? "") // "16355 bytes" isoLatin1 data size
guard let data = data else { print(error ?? "none")
return
}
let string = String(data: data, encoding: .isoLatin1) ?? "" // data is Latin1
print(string) // prints OK string is always UTF8
let isoLatin1Data = string.data(using: .isoLatin1) // 16355 bytes OK
print(isoLatin1Data == data) // true
let utf8Data = Data(string.utf8) // 16498 bytes
let string2 = String(data: utf8Data, encoding: .utf8) ?? ""
print(string == string2) // true
print(Data(string.utf8) == Data(string2.utf8)) // true
}.resume()
得到的字符串是:
// <?xml version="1.0" encoding="ISO-8859-1" ?>
Folha去S.Paulo - Colunas - 莫妮卡贝加莫 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/ Primeiro EM新闻报TE mpo real emlínguaportuguesa pt-br 版权Folha de S.Paulo。 Todos os direitos reservados。 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/folha/conheca/arquivo_e_copyright.shtml [email protected](网站管理员Folha德S.Paulo) colunas/monicabergamo/
Folha德S.保罗 - 列 - 莫妮卡贝加莫 http://f.i.uol.com.br/folha/furniture/5.2/images/lgo-folha_de_spaulo-167x31.gif http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/ * http://www1.folha.uol.com.br/colunas/monicabergamo/ 实时第一张报纸在葡萄牙
阿尔克明队看到多里亚 '疯狂' 研究 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924066-geraldo-alckmin-e-michel-temer-ensaiam-reaproximacao.shtml 州长杰拉尔阿尔克明(PSDB-SP)会见了上周日他的政治和通信人员分析人数< A HREF = " http://www1.folha.uol.com.br/poder/2017/10/1923269-forca-eleitoral-de-lula-resiste-apos-condenacao-na-lava-jato.shtml">Datafolha</a>还有他的团队通过电话进行的研究,其数量与该研究所的数量相符。他们的结论是,与他的领带与约翰·多里亚,市长将& QUOT; &疯狂QUOT;并加紧竞选总统候选人。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924066-geraldo-alckmin-e-michel-temer-ensaiam-reaproximacao.shtml">Leia更</A >(2017年4月10日 - 凌晨2:00) 2017年10月4日02:00:00 -0300 外交官批评恐惧被删除领事馆NY http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924064-diplomata-que-criticou-temer-e-removido-de-consulado-em-ny.shtml 外交官胡里奥·奥利维拉·席尔瓦在星期二删除(3)巴西在纽约外国阿洛伊·努内斯·费雷拉(PSDB-SP)领事馆的第二书记的职务。他没有收到任何事先通知或解释,并从官方公报了解到。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924064-diplomata-que-criticou-temer-e-removido-de-consulado-em-ny.shtml">Leia更</A >(2017年4月10日 - 凌晨2:00) 2017年10月4日02:00:00 -0300 司法部长希望改变原有等级在国内 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924062-ministro-da-justica-quer-mudar-classificacao-indicativa-no-pais.shtml 司法部长,托尔花园,想改变家长评级系统在巴西。 & QUOT;我们将继续在巴西利亚崩溃告诉在哪一个可以观看全国小说和电影的时代?这很疯狂。他说,现在是社会把它当作“&”的时候了。 < A HREF = "http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1924062-ministro-da-justica-quer-mudar-classificacao-indicativa-no-pais.shtml">Leia更</A >(2017年10月4日 - 凌晨2:00) 2017年10月4日02:00:00 -0300 健康计划已经损失了七级十万的用户,去年,协会说根据FenaSaúde的调查,这代表了行业最大的运营商,并与同月在圣保罗2016年相比 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923878-planos-de-saude-perderam-700-mil-usuarios-no-ultimo-ano-diz-associacao.shtml 健康计划已经在八月损失了七个十万用户独显370,000家客户少,将这次秋季归功于危机。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923878-planos-de-saude-perderam-700-mil-usuarios-no-ultimo-ano-diz-associacao.shtml">Leia更</A >(2017年3月10日 - 11:50) 2017年10月3日11:50:00 -0300 国防部认为,帕洛奇会在家里过圣诞节 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923730-defesa-acredita-que-palocci-passara-o-natal-em-casa.shtml 安东尼奥·帕洛奇的防御认为,财政部前部长会在家里过圣诞节。虽然,关闭奖励举报人同意后,他不得不花更多的时间在监狱里,希望的是,它从受益的权限来庆祝这一天在家里陪家人。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923730-defesa-acredita-que-palocci-passara-o-natal-em-casa.shtml">Leia更< /一个>(二○一七年三月一十日 - 上午02点00分) 2017年10月3日02:00:00 -0300 视频上曝光产生的Doria和MAM http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/之间张力http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923727-video-sobre-exposicao-gera-tensao-entre-e-doria-e-o-mam.shtml A HREF = <的http://www1.folha.uol.com.br/ilustrada/2017/09/1923259-em-video-joao-doria-condena-mostra-queermuseu-e-performance-no-mam.shtml">manifestação</a> ";约翰·多里亚对< A HREF = "MAM </A >(现代艺术博物馆),显示一个裸体男子惊讶,造成不适机构的董事。他们期待的巨嘴鸟被定位在言论自由的防线。 < A HREF =更" http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923727-video-sobre-exposicao-gera-tensao-entre-e-doria-e-o-mam.shtml">Leia </A >(2017年10月3日 - 凌晨2:00) 2017年10月3日02:00:00 -0300 卢森博格供认作为卢拉的儿子辩方证人 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923584-vanderlei-luxemburgo-depoe-como-testemunha-de-defesa-de-filho-de-lula.shtml < A HREF = " http://www1.folha.uol.com.br/poder/2017/08/1906136-lula-chama-ex-presidentes-franceses-como-testemunhas-de-defesa.shtml">Vanderlei卢森堡< /一个>,运动教练,将作证上的第二(2),为防御证人< A HREF = "下午克劳迪奥·卢拉·达席尔瓦< /在操作狂热者过程>儿子前总统卢拉的。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923584-vanderlei-luxemburgo-depoe-como-testemunha-de-defesa-de-filho-de-lula.shtml">Leia更</A >(2017年10月2日 - 13h44) 2017年10月2日13时44分零零秒-0300 先生问CPI让梅雷莱斯和兄弟浸 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/对峙http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923094-deputado-pede-que-cpi-faca-acareacao-entre-meirelles-e-irmaos-batista.shtml CPI JBS在本周决定提交恩里克梅雷莱斯,财政部长,与Joesley和韦斯利巴蒂斯塔,该公司业主的对抗。这位部长是Ĵ&放大器的董事会主席; F,该集团的控股公司。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923094-deputado-pede-que-cpi-faca-acareacao-entre-meirelles-e-irmaos-batista.shtml">Leia更< /一个>(2017年2月10日 - 上午02点00分) 2017年10月2日02:00:00 -0300 举报人Odebrecht公司开始接收的STF http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923085-delatores-da-odebrecht-comecam-a-receber-intimacao-do-stf.shtml通知 举报人Odebrecht公司开始与所述正义制成,并且协作安排接收来自所述最高法院(最高法院)传票开始采取的通过< A HREF确定的变化通知= " http://www1.folha.uol.com.br/poder/2017/01/1854148-carmen-lucia-homologa-77-delacoes-da-odebrecht.shtml">Cármen圣卢西亚< /在每个它们的>。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923085-delatores-da-odebrecht-comecam-a-receber-intimacao-do-stf.shtml">Leia更</A >(2017年10月2日 - 凌晨2:00) 2017年10月2日02:00:00 -0300 "我尽量保持我的头回想着走"说莱·苏沙 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923105-tento-manter-a-cabeca-pensando-que-voltarei-a-andar-diz-lais-souza.shtml <b>的& QUOT;主题胜利& QUOT; </B >,在电视上的巴西运动员的音乐至高无上的成就,打球时<b>莱·苏沙</B >,28,进入礼堂。一位前体操运动员帮助国家队获得2004年和2008年的历史业绩2014年奥运会上,正准备代表国家以新的方式,滑雪,当他遭受了留给她四肢瘫痪事故。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/10/1923105-tento-manter-a-cabeca-pensando-que-voltarei-a-andar-diz-lais-souza.shtml">Leia更</A >(2017年10月1日 - 凌晨2:00) 2017年10月1日02:00:00 -0300 里亚挑战赛达的研究,评估盟友 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1923081-desafio-de-doria-e-subir-na-pesquisa-avaliam-aliados.shtml 约翰·多里亚秘书分析一下他在接下来的几个投票站增长,机构可靠,让你的总统竞选没有失事甚至起飞之前。 < A HREF =http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1923081-desafio-de-doria-e-subir-na-pesquisa-avaliam-aliados.shtml">Leia " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/更</A >(2017年9月30日 - 凌晨2:00) 二零一七年九月三十零日02:00:00 -0300 配方装载机涉嫌在购物盗窃3月25日 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1922942-carregador-da-receita-e-preso-por-furto-no-shopping-25-de-marco.shtml 国税局的服务提供商A HREF中被捕= < " http://www1.folha.uol.com.br/cotidiano/2017/09/1917384-receita-federal-faz-operacao-para-combater-comercio-clandestino-em-sp.shtml">operação其关闭九月</A >购物3月25日,12。逮捕是在行为作出后的贸易商人看到,对于访问的手机,充电器外包偷用R $ 522的信息由国税局证实腰包安全摄像机。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1922942-carregador-da-receita-e-preso-por-furto-no-shopping-25-de-marco.shtml">Leia更< /一个>(2017年9月30日 - 上午02点00分) 2017年9月30日02:00:00 -0300 维罗索会不适应Haddad的 http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1922903-caetano-veloso-nao-vai-a-encontro-com-haddad.shtml 歌手卡耶塔诺费洛索将不会出现在今天的艺术家会见费尔南多·哈达德,在里约热内卢。 < A HREF = " http://redir.folha.com.br/redir/online/colunas/monicabergamo/rss091/http://www1.folha.uol.com.br/colunas/monicabergamo/2017/09/1922903-caetano-veloso-nao-vai-a-encontro-com-haddad.shtml">Leia更</A >(29/09/2017 - 13h52) 2017年9月29日13:52:00 -0300 费尔南多·哈达德发现卡耶塔诺费洛索房子艺术家
< - 后文本限制
...很抱歉这么晚才回复,我DROP掉......但现在这是肯定的,它是* * ISOLatin1,但need'我在UTF-8字符”无乱码.. 。 –
@joaoBeno一旦过时了它在默认情况下是UTF-8字符串中,你需要当你使用,你不会得到上面的乱码个方法初始化你 –
顺便说一句解释数据字符串。它从网站上获取数据,并使用字符编码ISOLatin1当日期转换为字符串归因 –
使用的文档:https://developer.apple.com/documentation/swift/string/1418413-init,https://developer.apple.com/documentation/foundation/string.encoding/ISOLatin1-1780189和https://developer.apple.com/documentation/swift/string/1538904-withcs特林 – Palle
@Palle,没有这些链接的帮助,结束串是'nil',或用同样的编码作为前...你能 –
提供样品ISOLatin1字符串,你想转换? – user1046037