Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Missing currency symbol

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Thu Jun 26, 2014 8:04 am    Post subject: Missing currency symbol Reply with quote

Hi all, I'm using postgres as my database server and have come across a weird problem, in my postgres stored procedure I cast a numeric field to a formatted string which includes the currency symbol, e.g. 123.76 comes out as "123.76", viewing the output in postgres shows the output of type text which is as expected, but when I get the result of my sp into a ADO.NET dataset/datatable it comes through as a string OK but the currency symbol is missing and a leading blank is shown in its place - any ideas ?
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2435

PostPosted: Thu Jun 26, 2014 11:19 am    Post subject: Reply with quote

Re-install the affected font? That is, if you're sure that font should have the missing symbol in the first place, if the symbol wasn't defined in the font I'm not surprised it doesn't show up Wink Change to a different font to see where the issue actually is: if the missing symbol turns up, there's a problem with the original font.
Back to top
View user's profile Send private message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Thu Jun 26, 2014 11:23 am    Post subject: Reply with quote

Dutch_Master wrote:
Re-install the affected font? That is, if you're sure that font should have the missing symbol in the first place, if the symbol wasn't defined in the font I'm not surprised it doesn't show up Wink Change to a different font to see where the issue actually is: if the missing symbol turns up, there's a problem with the original font.


Hi there, it's not a font problem, the symbol ("" in this case ) is not being inserted into the dataset
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
johnhudson
LXF regular


Joined: Wed Aug 03, 2005 2:37 pm
Posts: 871

PostPosted: Thu Jun 26, 2014 9:51 pm    Post subject: Reply with quote

This is guesswork but the question is: what does postgres actually do?

AFAIK currency formats are not part of SQL; so, even if you CAST() a number as a currency and postgres displays it correctly, it may, for compatibility reasons, not be exported as such.

Alternatively, you may need to investigate the import options of the program that receives the data and match the postgres output to that - for example, currency symbols may not be accepted as part of numeric data.
Back to top
View user's profile Send private message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Thu Jun 26, 2014 10:08 pm    Post subject: Reply with quote

johnhudson wrote:
This is guesswork but the question is: what does postgres actually do?

AFAIK currency formats are not part of SQL; so, even if you CAST() a number as a currency and postgres displays it correctly, it may, for compatibility reasons, not be exported as such.

Alternatively, you may need to investigate the import options of the program that receives the data and match the postgres output to that - for example, currency symbols may not be accepted as part of numeric data.


Hi John, its not numeric data it's cast as text and as I stated earlier it comes through as such in the dataset and data table , something unbeknown to me is obviously happening on the journey from postgres to my programme, one thing I've tried ( among many ) is to remove the formatting in postgres I.e don't include the symbol and it still comes through with a leading blank space.
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
johnhudson
LXF regular


Joined: Wed Aug 03, 2005 2:37 pm
Posts: 871

PostPosted: Fri Jun 27, 2014 9:48 pm    Post subject: Reply with quote

Then is there an encoding problem, e.g. utf8 to unicode 16 or something like that?
Back to top
View user's profile Send private message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Fri Jun 27, 2014 10:05 pm    Post subject: Reply with quote

johnhudson wrote:
Then is there an encoding problem, e.g. utf8 to unicode 16 or something like that?


That's a thought I'll look into it thanks
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Mon Jun 30, 2014 10:03 am    Post subject: Reply with quote

johnhudson wrote:
Then is there an encoding problem, e.g. utf8 to unicode 16 or something like that?


Hi John, the encoding on the Postgres database is UTF8 which I'm sure must contain the currency symbol ? any more ideas ?
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
johnhudson
LXF regular


Joined: Wed Aug 03, 2005 2:37 pm
Posts: 871

PostPosted: Mon Jun 30, 2014 10:13 pm    Post subject: Reply with quote

ADO.NET is a Microsoft product and probably uses Unicode 16. That is why I wondered whether the problem is UTF8 to Unicode 16. But it may use a different encoding which would explain the problem.

Unicode 16 uses 2 bytes for every character whereas UTF8 uses a variable number of bytes depending on position in the sequence.

(I am surprised that you are getting the problem but this is the only explanation I can think of in the light of the information you have shared.)
Back to top
View user's profile Send private message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Tue Jul 01, 2014 6:18 am    Post subject: Reply with quote

johnhudson wrote:
ADO.NET is a Microsoft product and probably uses Unicode 16. That is why I wondered whether the problem is UTF8 to Unicode 16. But it may use a different encoding which would explain the problem.

Unicode 16 uses 2 bytes for every character whereas UTF8 uses a variable number of bytes depending on position in the sequence.

(I am surprised that you are getting the problem but this is the only explanation I can think of in the light of the information you have shared.)


Thanks John, what more information could I give to help nail this down, the system I'm writing is currently for my own use but with a view to offering it to others so I need to resolve this.

Edit
Just tried using the postgres Unicode ODBC driver and it worked perfectly so it must be an issue with the Npgsql driver that I'm using ( which is recommended for ADO.NET and indeed written in c# ) I'm on to the Npgsql( Mono project ) guys now as this is not good which is a shame as the performance and other functionality is very good
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast