Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2437F633C78 for ; Fri, 30 Apr 2010 07:21:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 09290-09 for ; Fri, 30 Apr 2010 10:21:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [67.192.120.76]) by mail.postgresql.org (Postfix) with ESMTP id 1CCCC633D0A for ; Fri, 30 Apr 2010 07:21:16 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=8A1p7KSS4ygJ3plHh03faM8l3LOa/lhNpRUu6mUYMNE=; b=eFXU2TbIo9A5P/Y/WBMcc+Ogf+HSz68n4Gi4pLZEVLKv5JXNXoUPREFRV63dqrOarkf/goG47WpmX+v2eOixvfdqnBioe+YIJ+Q+z5WNXG8QFZVpO2sVvyms10Ul+alU; Received: from ip-118-90-138-214.xdsl.xnet.co.nz ([118.90.138.214] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1O7nLO-0007CI-F1; mid 144 for pgsql-sql@postgresql.org; Fri, 30 Apr 2010 10:20:50 +0000 Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1O7nLE-0003Nk-0g for pgsql-sql@postgresql.org; Fri, 30 Apr 2010 22:21:04 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: [SPAM]-D] How to find broken UTF-8 characters ? Date: 30 Apr 2010 10:21:03 GMT Organization: Dis (not Dat) Organisation Lines: 21 Message-ID: References: <4BD4DA7B.3000603@gmx.net> <4BD5670A.803@bankir.ru> <4BD58A00.7030905@gmx.net> <4BD835AD.2050902@magwerks.com> <4BD8F038.6060601@gmx.net> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reversiblemaps.ath.cx 1272622863 13002 127.0.0.1 (30 Apr 2010 10:21:03 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Smtpcorp-Track: 1918427.1.25682168 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=AWL=-0.000, BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201004/117 X-Sequence-Number: 34044 On 2010-04-29, Andreas wrote: > Hi, > > while writing the reply below I found it sounds like beeing OT but it's > actually not. > I just need a way to check if a collumn contains values that CAN NOT be > converted from Utf8 to Latin1. > I tried: > Select convert_to (my_column::text, 'LATIN1') from my_table; > > It raises an error that says translated: > ERROR: character 0xe28093 in encoding »UTF8« has no equivalent in »LATIN1« use a regular expression. ISO8859-1 is easy, all the caracters a grouped together in unicode so the regular expression consists of a single inverted range class SELECT pkey FROM tabname WHERE ( textfield || textfiled2 || textfield3 ) ~ ('[^'||chr(1)||'-'||chr(255)||']');