My guess is you need to use utf-8 encoding not ascii.
something like
<meta charset="UTF-8">
 in your HTML header.

By the way, I'm interested in adding a geiger counter to my system. Where
did you get yours?


On Sun, Feb 18, 2024 at 1:13 PM bgra...@umw.edu <bgrat...@umw.edu> wrote:

> Hello,
> I am running weewx 4.10.2 (setup.py) on Ubuntu and Python3. All is fine
> except:
>
> I have data from a Geiger counter coming into weewx (Standard page) and
> being displayed in microSeverts, using the µSv mu character. Before adding
> this mu character, I was uploading to my emoncms server using the MQTT
> extension (0.17). Things have stopped being uploaded (see debug errors
> below) to emoncms.
> Is it possible to filter out the Geiger data as I don't need it going to
> emoncms, or is it possible to get the "µ" character accepted for the
> upload? I'm not a programmer so am somewhat lost here.  Thanks in advance.
> Cheers,
> Bob (grattans.org/wx)
>
> weewx.log:
> Feb 18 12:00:16 n4mrv weewx[39438] DEBUG weewx.reportengine: Running
> report 'StandardReport'
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: EmonCMS: Unexpected
> exception of type <class 'UnicodeEncodeError'>
> Feb 18 12:00:16 n4mrv weewx[39438] DEBUG weewx.reportengine: Found
> configuration file /home/weewx/skins/Standard/skin.conf for report
> 'StandardReport'
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: *** Traceback (most
> recent call last):
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/home/weewx/bin/weewx/restx.py", line 382, in run_loop
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> self.process_record(_record, dbmanager)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/home/weewx/bin/user/emoncms.py", line 288, in process_record
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> self.post_with_retries(req)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/home/weewx/bin/weewx/restx.py", line 477, in post_with_retries
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     _response =
> self.post_request(request, data)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/home/weewx/bin/weewx/restx.py", line 541, in post_request
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     _response =
> urllib.request.urlopen(request, data=data_bytes, timeout=self.timeout)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     return
> opener.open(url, data, timeout)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 519, in open
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     response =
> self._open(req, data)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 536, in _open
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     result =
> self._call_chain(self.handle_open, protocol, protocol +
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     result =
> func(*args)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 1377, in http_open
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     return
> self.do_open(http.client.HTTPConnection, req)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> h.request(req.get_method(), req.selector, req.data, headers,
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/http/client.py", line 1283, in request
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> self._send_request(method, url, body, headers, encode_chunked)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/http/client.py", line 1294, in _send_request
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> self.putrequest(method, url, **skips)
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/http/client.py", line 1132, in putrequest
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> self._output(self._encode_request(request))
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***   File
> "/usr/lib/python3.10/http/client.py", line 1212, in _encode_request
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***     return
> request.encode('ascii')
> Feb 18 12:00:16 n4mrv weewx[39438] ERROR weewx.restx: ***
> UnicodeEncodeError: 'ascii' codec can't encode character '\xb5' in position
> 644: ordinal not in range(128)
> Feb 18 12:00:16 n4mrv weewx[39438] CRITICAL weewx.restx: EmonCMS: Thread
> terminating. Reason: 'ascii' codec can't encode character '\xb5' in
> position 644: ordinal not in range(128)
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/624ac5d6-4645-44b2-b925-5f95927154c1n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/624ac5d6-4645-44b2-b925-5f95927154c1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Peter Quinn
(415)794-2264

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAA1SM20AsDygdSF1Cv_TgvJLgHgx%2Ba1ckqBBMSW15YwiX%3DfPCw%40mail.gmail.com.

Reply via email to